19 May '13 - 21:36 *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Reply  |  Print  
Author Topic: ICY/HTTP tags  (Read 1069 times)
jjh76
Posts: 5


« on: 10 Apr '12 - 20:30 »
Reply with quoteQuote

I'm using bass in a FreeBASIC project. When using it with a radio, I'm trying to get the data from the ICY or HTTP tags when available. For ICY, I've been using this and it seems to be working fine:

test = BASS_ChannelGetTags(o.stream,BASS_TAG_ICY)
txt = *test
while txt<>""
print txt
test += len(txt)+1
txt = *test
wend

But when I try re-use this code for HTTP:

test = BASS_ChannelGetTags(o.stream,BASS_TAG_HTTP)
txt = *test
while txt<>""
print,txt
test += len(txt)+1
txt = *test
wend

Even if I get the "HTTP/1.0 200 OK" message, it doesn't give me anything else. Do the HTTP tags have a different format, or is it just that the stations I've been trying this with aren't giving out that data even though I get the ok message?
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #1 on: 11 Apr '12 - 16:31 »
Reply with quoteQuote

Yep, you generally won't get anything more than "HTTP/1.0 200 OK" in the HTTP headers from a Shoutcast server. To test HTTP header support, you could try an Icecast server instead or stream a file from a web server.
Logged
gnag
Posts: 160


« Reply #2 on: 11 Apr '12 - 20:14 »
Reply with quoteQuote

I have been working with Shoutcast Servers too, you can send a GET Request to the Server on a certain File and it will send you back the current (Song) Informations. But you have to be careful with the Request Headers, for example if you try to just open http://server:port/7.html in your Browser it will NOT work, also if you don't send the User Agent it will not work and return Statuscode 404 / Ressource not found.

Request
GET /7.html HTTP/1.0\r\nUser-Agent: XML Getter (Mozilla Compatible)\r\n\r\n

If you send the Request like the one above you will receive a response like this.

Response (Comes with "HTTP/1.0 200 OK")
<HTML><meta http-equiv="Pragma" content="no-cache"></head><body>118,1,121,120,106,192,Jason Derulo - German TOP100 Single Charts - Breathing</body></html>

I am not sure but this could be the Way Bass retreives the current Song Info, since I saw that the Response is the same.
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #3 on: 12 Apr '12 - 14:25 »
Reply with quoteQuote

A Shoutcast server can be asked to send title updates in amongst the audio data, so that is what most (probably all) players will do. That separate info request is a neat trick though Smiley
Logged
jjh76
Posts: 5


« Reply #4 on: 12 Apr '12 - 23:58 »
Reply with quoteQuote

I have been using BASS_TAG_META to get the info but that doesn't always have the song title in it, which is why I was trying to figure out the ICY/HTTP stuff. But in my experiments I've found that the ICY/HTTP headers, even when available, haven't had the song title in it either. Does BASS have a some built-in function that can check all the different protocols and return just the name of the current song?
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #5 on: 13 Apr '12 - 15:50 »
Reply with quoteQuote

When are you checking the BASS_TAG_META tag? As the metadata is sent in amongst the audio data (not in the headers), it won't necessarily be available immediately after the BASS_StreamCreateURL call. You can set a BASS_SYNC_META sync to get notification of when metadata is received. You can have a look at the NETRADIO example (in the BASS package) for a little demonstration.
Logged
jjh76
Posts: 5


« Reply #6 on: 13 Apr '12 - 16:32 »
Reply with quoteQuote

I'm checking in my screen drawing thread - every frame before it redraws the images it checks and if the tag has changed it tries to retrieve the song title from the new string. But as I said, the tag doesn't always have that info in it. With some broadcasts I'll get : "StreamTitle='song name';StreamUrl='http:\\whatever';" But with some others I might get just StreamTitle=''; or even something that's in a completely different format. With the ones that return in a different format I can just write a new parser routine to get the data I want, but I'm trying to find other ways to get the song title when that info is missing from the meta tag.
Logged
Ian @ un4seen
Administrator
Posts: 15244


« Reply #7 on: 13 Apr '12 - 17:18 »
Reply with quoteQuote

That sounds a bit strange. Is the problem happening with a particular URL? For comparison, what do you see in the pre-compiled NETRADIO.EXE example (in the C\BIN directory) if you try playing the same URL at the same time with it, ie. does it receive/display title updates while your player doesn't? You could also try playing the URL with another (non-BASS) player for an additional comparison.
Logged
jjh76
Posts: 5


« Reply #8 on: 13 Apr '12 - 19:35 »
Reply with quoteQuote

Here's a few random ones I've tried:

http://icecast.databoss.nl:8000/wildfm.mp3

With my project, the tag gives me:  StreamTitle=''; 
the netradio demo doesn't show the song title, but it does show the channel info - "Wild FM Hitradio - Hosted by Databoss.nl" (i'm assuming it's getting that from the ICY/HTTP headers)

http://wbgo.streamguys.net

I get:  StreamTitle='';
the demo shows: WGBO Newark Public Radio

http://touhouradio.com:8000/touhouradio.mp3

I get: StreamTitle='';
the demo shows:  Touhou Radio MP3

I've also tried these all in winamp, but it also doesn't show the song titles for any of them

 
Logged
jaromanda
Posts: 22


« Reply #9 on: 15 Apr '12 - 16:26 »
Reply with quoteQuote


I've also tried these all in winamp, but it also doesn't show the song titles for any of them


None of those stations send song titles. Many stations do this so they don't attract scum stream rippers to their stations. Others don't have the means to send song titles due to the way they are set up.
Logged
gnag
Posts: 160


« Reply #10 on: 15 Apr '12 - 16:37 »
Reply with quoteQuote

Yes, most Stations don't send Song Title Informations to avoid Rippers.

But almost all of them (atleast the ones jjh76 posted) have Song Informations on their Website, if you don't need to get realtime Information (would cause a lot of Traffic on their Web Servers) you can just grab their Websites HTML Code and parse it for Interpret/Title to show it in your Software.
Logged
jaromanda
Posts: 22


« Reply #11 on: 15 Apr '12 - 23:13 »
Reply with quoteQuote

But almost all of them (atleast the ones jjh76 posted) have Song Informations on their Website,
my point was regarding the icecast server, not a website associated with the icecast server - sure, I may have misunderstood the question jjh76 was asking
Logged
jjh76
Posts: 5


« Reply #12 on: 17 Apr '12 - 05:20 »
Reply with quoteQuote

I see, guess I'll just have to put in a "song name not available" message for those servers.
Logged
Pages: [1]
  Reply  |  Print  
 
Jump to:  

Powered by SMF 1.1.18 | SMF © 2013, Simple Machines