Author Topic: Internet Radio  (Read 24354 times)

0 Members and 1 Guest are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Internet Radio
« Reply #45 on: June 09, 2014, 08:19:13 AM »
Radio paradise is a class 1 radio station.  They provide an XML now playing feed which is easy to read.  Trying to do this with a generic shoutcast radio station is a completely different story.  Finding a page with now playing information on it is not so easy.  It actually seems like shoutcast has tried to make it difficult for us. Nime5ter is working on a solution using robobrowser, but it may not work for all shoutcast stations.  You will need to manually inspect the pls file for a given station to find the IP address of the stream.

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: Internet Radio
« Reply #46 on: June 09, 2014, 09:12:53 AM »
Radio paradise is a class 1 radio station.  They provide an XML now playing feed which is easy to read.  Trying to do this with a generic shoutcast radio station is a completely different story.  Finding a page with now playing information on it is not so easy.  It actually seems like shoutcast has tried to make it difficult for us. Nime5ter is working on a solution using robobrowser, but it may not work for all shoutcast stations.  You will need to manually inspect the pls file for a given station to find the IP address of the stream.

Thanks. Will await possible solution while I read some more.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Internet Radio
« Reply #47 on: June 09, 2014, 09:38:11 AM »
Actually, we don't need to use the RoboBrowser plugin after all, though it's one option.

It seems that Shoutcast feeds require a get request that specifies a "user agent". We have a specific scrape action for such sites in VC: http://voxcommando.com/mediawiki/index.php?title=Actions#Scrape

There is no universal, easy answer for how to find the information we need, unfortunately. If looking at a site's page source directly doesn't give the answer, then we have to dig a little, do some web searches, etc.

In the case of your particular jazz feed, I was able to look at the pls file (I used Notepad++) to find the URL for that stream. When I went to that page, I saw it had what looked like scrape-able song information on it. When I tried to use a regular scrape, I got an error. I was able to use RoboBrowser instead, but this is much less efficient. Looking up that error and how Shoutcast works, we figured out that they require user agent info in the header, so I used that action instead, and was able to scrape the page that contains now playing data.

Basically, if you have the time/interest in investigating and finding a solution, there usually is one, but there are no hard and fast rules. Different sites work differently.

The folllowing command gets the current song data for the Florida jazz stream:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 1.9.5.5-->
<command id="279" name="get Florida Jazz song info" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>Scrape.UserAgent</cmdType>
    <params>
      <param>http://38.96.175.21:8802</param>
      <param>Mozilla</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>System.SetClipboardText</cmdType>
    <params>
      <param>{LastResult}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>Results.RegEx</cmdType>
    <params>
      <param>Current.Song:.*?&lt;b&gt;(.*?).-.(.*?)&lt;/b&gt;</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>OSD.ShowText</cmdType>
    <params>
      <param>Artist: {Match.1.1}{cr}Song: {Match.1.2}</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <action>
    <cmdType>TTS.Speak</cmdType>
    <params>
      <param>This is the song {Match.1.2}, by the artist {Match.1.1}.</param>
    </params>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <phrase>get song info</phrase>
</command>

(Note that my regular expression won't work if you're using version 1 of VC, but the regular expression can be re-written if needed. It's just that VC2 offers much more efficient syntax for such things.)
« Last Edit: June 09, 2014, 09:43:16 AM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: Internet Radio
« Reply #48 on: June 09, 2014, 12:33:22 PM »
Actually, we don't need to use the RoboBrowser plugin after all, though it's one option.

It seems that Shoutcast feeds require a get request that specifies a "user agent". We have a specific scrape action for such sites in VC: http://voxcommando.com/mediawiki/index.php?title=Actions#Scrape

There is no universal, easy answer for how to find the information we need, unfortunately. If looking at a site's page source directly doesn't give the answer, then we have to dig a little, do some web searches, etc.

In the case of your particular jazz feed, I was able to look at the pls file (I used Notepad++) to find the URL for that stream. When I went to that page, I saw it had what looked like scrape-able song information on it. When I tried to use a regular scrape, I got an error. I was able to use RoboBrowser instead, but this is much less efficient. Looking up that error and how Shoutcast works, we figured out that they require user agent info in the header, so I used that action instead, and was able to scrape the page that contains now playing data.

Basically, if you have the time/interest in investigating and finding a solution, there usually is one, but there are no hard and fast rules. Different sites work differently.



Thanks. Got it working. With the info provided I will play with it further to see if I have any additional questions. There is one thing I have noticed. The voice providing the info is very low. Can the volume level of the stream be reduced ?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Internet Radio
« Reply #49 on: June 09, 2014, 01:22:11 PM »
We appreciate it if you to try to look a bit before you ask.  This information should be easy to find in the wiki if you look.

http://voxcommando.com/mediawiki/index.php?title=Actions#SetStreamVol

http://voxcommando.com/forum/index.php?topic=1140.msg10852#msg10852
« Last Edit: June 09, 2014, 01:27:08 PM by jitterjames »

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: Internet Radio
« Reply #50 on: June 09, 2014, 01:54:22 PM »
We appreciate it if you to try to look a bit before you ask.  This information should be easy to find in the wiki if you look.

http://voxcommando.com/mediawiki/index.php?title=Actions#SetStreamVol

http://voxcommando.com/forum/index.php?topic=1140.msg10852#msg10852

Thanks. Sorry about that.

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: Internet Radio
« Reply #51 on: June 12, 2014, 12:23:56 AM »
@nime5ter
Since your kind assistance, I have been searching the web for help to learn more on how to get song info from internet radio websites. I am using this site as my test:

http://www.internet-radio.com/station/allirishradio/.

I have got it setup to stream and the info I now need for this site is the scrape url similar to the undernoted. I am not asking you to do the work but wonder if you can provide any additional guidance to that previously included in your post above. I have tried a number of suggestions I found on the net but none of them helped.

<param>http://38.96.175.21:8802</param>

Thanks.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Internet Radio
« Reply #52 on: June 12, 2014, 09:22:09 AM »
Hi lja,

I'm sorry, I'm not sure what you are looking for at this point.

Your internet-radio.com webpage is showing a stream for Irish KISS FM. If that's the stream you're interested in, you have at least 2 options.

1. Follow the link that they provide to the radio station's website. There you can see a link to their "last 10 played" page. The top song is the currently playing song, so you could scrape that page if you like.

Or:

2. Do the same thing that I did with the jazz station example. Download the Ireland's KISS FM playlist file (m3u or pls or whatever) that is available at the link you posted above. You mention that you're able to set up the stream, so it sounds as though you've found that.

That file contains the URL (sometimes more than one, but in this case, just one) that you want to scrape. You can enter that URL directly in your web browser. It is exactly like the Smooth Jazz example.

If you compare the information contained on that page to the "Last 10 Played on KISS FM Ireland" page, you'll see that they both show the currently playing song, along with some other, different data.

I apologize if I'm misunderstanding what you're asking, but hopefully that helps.
« Last Edit: June 12, 2014, 12:56:36 PM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Internet Radio
« Reply #53 on: June 12, 2014, 09:33:33 AM »
And of course, you can always try playing the radio streams in your favourite media player -- XBMC, MM or whatnot, and get the "now playing" information through the relevant VC commands.

There are Shoutcast and Icecast addons for XBMC, among other Internet radio options.
« Last Edit: June 12, 2014, 12:56:19 PM by nime5ter »
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: Internet Radio
« Reply #54 on: June 12, 2014, 03:48:11 PM »
Hi lja,

I'm sorry, I'm not sure what you are looking for at this point.

Your internet-radio.com webpage is showing a stream for Irish KISS FM. If that's the stream you're interested in, you have at least 2 options.

1. Follow the link that they provide to the radio station's website. There you can see a link to their "last 10 played" page. The top song is the currently playing song, so you could scrape that page if you like.

Or:

2. Do the same thing that I did with the jazz station example. Download the Ireland's KISS FM playlist file (m3u or pls or whatever) that is available at the link you posted above. You mention that you're able to set up the stream, so it sounds as though you've found that.

That file contains the URL (sometimes more than one, but in this case, just one) that you want to scrape. You can enter that URL directly in your web browser. It is exactly like the Smooth Jazz example.

If you compare the information contained on that page to the "Last 10 Played on KISS FM Ireland" page, you'll see that they both show the currently playing song, along with some other, different data.

I apologize if I'm misunderstanding what you're asking, but hopefully that helps.

Thanks. No apology necessary as you did understand what I was asking. I will check this out.

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: Internet Radio
« Reply #55 on: June 12, 2014, 03:50:15 PM »
And of course, you can always try playing the radio streams in your favourite media player -- XBMC, MM or whatnot, and get the "now playing" information through the relevant VC commands.

There are Shoutcast and Icecast addons for XBMC, among other Internet radio options.

Thanks. I will also check this. I will do some searching re the commands.

lja

  • Sr. Member
  • ****
  • Posts: 145
  • Karma: 5
    • View Profile
Re: Internet Radio
« Reply #56 on: June 16, 2014, 11:25:00 AM »
@nime5ter

Thanks very much for all your help. I have finally been able to locate the urls and tested on a few stations.

jesusq

  • Jr. Member
  • **
  • Posts: 4
  • Karma: 0
    • View Profile
Re: Internet Radio
« Reply #57 on: June 23, 2014, 02:40:45 PM »
Awesome

Hiryu

  • Contributor
  • ***
  • Posts: 53
  • Karma: 2
    • View Profile
Re: Internet Radio
« Reply #58 on: August 16, 2014, 11:52:56 AM »
Newbie here -- tried to copy and paste the initial post code.  When I say the command "start the stream" the history log returns "can't find command: The given key was not present in the dictionary."

First time encountering this so was wondering what that means?  I tried restarting VC, rebuilding grammars.  I'm on VC 2.0.0.0 SP. 

Appreciate the help.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Internet Radio
« Reply #59 on: August 16, 2014, 01:43:03 PM »
Hm. If you mean jitterjames's xml here: http://voxcommando.com/forum/index.php?topic=1140.msg9570#msg9570 -- I am not running into any problems in either SP or the standard versions. I am using a later version than 2.0, but I don't think it matters.

Have you tried purging your cache yet?
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)