4

I want to receive metadata from this station:

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

In order to achieve this I did the following request via shell:

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

Although I expected to receive the Icy-metaint value, it don't throws any output.

I also did the following request:

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

This yields:

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

What am I doing wrong?

LaPriWa
  • 145
  • 1
  • 5

1 Answers1

5

You should verify, that the command you are using really sends that header.

Using cURL it works just fine (see last line of output):

$ 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
< 
TBR
  • 303
  • 1
  • 5
  • Thank you very much! :-D I have one last question: Why must I redirect the output to /dev/null? – LaPriWa Apr 25 '16 at 14:08
  • 1
    That was just to limit the output to the headers by redirecting the body to /dev/null. For your use case you'll probably want to digest the data stream and parse at the signalled 'metaint'. – TBR Apr 25 '16 at 14:31
  • 1
    Personally, I'd probably look at their website interface, as they show metadata there too. Might be easier than carving it out of a stream. – TBR Apr 25 '16 at 14:37
  • 1
    The website interface is subject to change at any time, probably breaking programs dependent on it. Shoutcast specification won't change any time soon and would be the safer method. Using the metadata is also portable to other shoutcast/icecast servers and not just SoMaFM.(a great internet radio station collection btw) – Hydranix Oct 26 '16 at 20:38