从 Icecast-audio-stream 捕获元数据

从 Icecast-audio-stream 捕获元数据

我想接收来自此电台的元数据:

http://ice1.somafm.com/deepspaceone-128-mp3

为了实现这一点我通过 shell 发出了以下请求:

$ GET -H "Icy-MetaData: 1" http://ice1.somafm.com/deepspaceone-128-mp3

尽管我期望收到该Icy-metaint值,但它没有抛出任何输出。

我还做了以下请求:

$ HEAD http://ice1.somafm.com/deepspaceone-128-mp3

得出:

200 OK
Cache-Control: no-cache, no-store
Connection: Close
Date: Sun, 24 Apr 2016 07:23:14 GMT
Pragma: no-cache
Server: Icecast 2.4.0-kh3
Content-Type: audio/mpeg
Expires: Mon, 26 Jul 1997 05:00:00 GMT
Access-Control-Allow-Headers: Origin, Accept, X-Requested-With, Content-Type
Access-Control-Allow-Methods: GET, OPTIONS, HEAD
Access-Control-Allow-Origin: *
Client-Date: Sun, 24 Apr 2016 07:21:38 GMT
Client-Peer: 173.239.76.148:80
Client-Response-Num: 1
Icy-Br: 128
Icy-Genre: Ambient Space
Icy-Name: Deep Space One: Deep ambient electronic and space music. [SomaFM]
Icy-Notice1: <BR>This stream requires <a href="http://www.winamp.com/">Winamp</a><BR>
Icy-Notice2: SHOUTcast Distributed Network Audio Server/Linux v1.9.5<BR>
Icy-Pub: 0
Icy-Url: http://somafm.com

我究竟做错了什么?

答案1

您应该验证您使用的命令是否确实发送了该标头。

使用卷曲它运行良好(参见输出的最后一行):

$ curl -H "Icy-MetaData: 1" -v "http://ice1.somafm.com/deepspaceone-128-mp3" >/dev/null
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0*   Trying 173.239.76.148...
  0     0    0     0    0     0      0      0 --:--:-- --:--:-- --:--:--     0* Connected to ice1.somafm.com (173.239.76.148) port 80 (#0)
> GET /deepspaceone-128-mp3 HTTP/1.1
> Host: ice1.somafm.com
> User-Agent: curl/7.45.0
> Accept: */*
> Icy-MetaData: 1
> 
* HTTP 1.0, assume close after body
< HTTP/1.0 200 OK
< Content-Type: audio/mpeg
< Date: Mon, 25 Apr 2016 04:16:47 GMT
< icy-br:128
< icy-genre:Ambient Space
< icy-name:Deep Space One: Deep ambient electronic and space music. [SomaFM]
< icy-notice1:<BR>This stream requires <a href="http://www.winamp.com/">Winamp</a><BR>
< icy-notice2:SHOUTcast Distributed Network Audio Server/Linux v1.9.5<BR>
< icy-pub:0
< icy-url:http://somafm.com
< Server: Icecast 2.4.0-kh3
< Cache-Control: no-cache, no-store
< Pragma: no-cache
< Access-Control-Allow-Origin: *
< Access-Control-Allow-Headers: Origin, Accept, X-Requested-With, Content-Type
< Access-Control-Allow-Methods: GET, OPTIONS, HEAD
< Connection: Close
< Expires: Mon, 26 Jul 1997 05:00:00 GMT
< icy-metaint:45000
< 

相关内容