News:

HOT TIP! Enable the History Window in the main UI when trying to problem solve. It provides a handy log of what is happening. Roll over lines in the History to get more details.

Main Menu

XBMC radio add-on?

Started by nime5ter, October 10, 2013, 11:20:22 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nime5ter

Is anyone here using the Radio music plugin for XBMC? (http://forum.xbmc.org/showthread.php?tid=119362)

Apparently, the plugin gives easy access to any of the radio broadcasts powered by the websites http://www.radio.de (German), http://www.rad.io (English), and http://www.radio.fr (French).

If you are using it, have you made any custom VC commands for it?
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)

jitterjames

#1
Here is a command to select a random station by genre using the XBMC addon "radio".
http://wiki.xbmc.org/index.php?title=Add-on:Radio

You need to put the payloadXML file in your payloads folder and then modify it to include the genres you want to use.

<?xml version="1.0" encoding="utf-16"?>
<command id="435" name="radio test 2" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
 <action>
   <cmdType>XJson.Btn.KB</cmdType>
   <cmdString>stop</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>TTS.SpeakSync</cmdType>
   <cmdString>Please wait while I search for {1} radio stations</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>XJson.Raw</cmdType>
   <cmdString>GUI.ActivateWindow&amp;&amp;"window": "music", "parameters": [ "plugin://plugin.audio.radio_de/stations/genre/{1}/" ]</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>PY.ExecString</cmdType>
   <cmdString>import random</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>PY.ExecString</cmdType>
   <cmdString>result=random.randint(1,500)</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>Results.SetVar</cmdType>
   <cmdString>myrand&amp;&amp;{LastResult}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>OSD.ShowText</cmdType>
   <cmdString>random number: {Var.myrand}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>XJson.Raw</cmdType>
   <cmdString>XBMC.GetInfoLabels&amp;&amp;"labels": ["Container(id).ListItem({Var.myrand}).Label"]</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>Results.RegEx</cmdType>
   <cmdString>:."(.*)"</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>TTS.Speak</cmdType>
   <cmdString>Opening Stream: {Match.1}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>OSD.AddText</cmdType>
   <cmdString>Opening Stream: {Match.1}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>XJson.Raw</cmdType>
   <cmdString>XBMC.GetInfoLabels&amp;&amp;"labels": ["Container(id).ListItem({Var.myrand}).FileName"]</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>Results.RegEx</cmdType>
   <cmdString>:."(.*)"</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>OSD.AddText</cmdType>
   <cmdString>item id: {Match.1}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>XJson.ExecBuiltin</cmdType>
   <cmdString>PlayMedia(plugin://plugin.audio.radio_de/station/{Match.1})</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>VC.Pause</cmdType>
   <cmdString>4000</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>XJson.Raw</cmdType>
   <cmdString>GUI.SetFullscreen&amp;&amp;"fullscreen":"toggle"</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <phrase>pick some</phrase>
 <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\RadioGenres.xml</payloadFromXML>
 <phrase>radio for me</phrase>
</command>

jitterjames

Here is a comprehensive list of genres as generated from

http://www.rad.io/info/menu/valuesofcategory?category=_genre

jitterjames

and if you use the plugin in German mode, I think the command will still work, you just need to use slightly different Genres as found here:

http://www.radio.de/info/menu/valuesofcategory?category=_genre

Kalle

First - big thanks to nime and James, for this really useful command (and also for the hint to this radio add-on)
It works perfect, I've insert at the end of the command a "VC.triggerEvent" action, which trigger a "what song is this" command.

One question: how can select a radio station directly in the add-on? Like "play radio station 'HitradioFFH' "

GUI.ActivateWindow&amp;&amp;"window": "music", "parameters": [ "plugin://plugin.audio.radio_de/stations/genre/{1}/" ]</cmdString>

Thanks for help
***********  get excited and make things  **********

jitterjames

#5
You can do this with a payload xml.  The command is actually much simpler.

I am attaching a payloadXML with ALL the german radio stations that I copied from the rad.io website.  You will probably want to edit the list down to just the stations you want to use, and then maybe edit the phrases to make them easier to say, and maybe add alias phrases for some of them using commas.

I don't know how stable the radio station IDs are on this site.  If the IDs change then you will need to update your payloadXML.

It is also possible to get the actual streams from this site if you want to play the streams directly from something other than XBMC.  For example this link will give you details for the station ID: 8207 including the url of the stream which you can use in media monkey, itunes etc. or even play directly using VoxCommando's Sound.Playstream action.
http://www.rad.io/info/broadcast/getbroadcastembedded?broadcast=8207

By the way this site does something weird that prevents us from using the scrape command.  ???  To make the payloadXML I just used my web browser, copied the json to notepad++ and then used find and replace to get the columns for ID and Name which I then pasted into the VC payload editor. Easy!  :biglaugh

<?xml version="1.0" encoding="utf-16"?>
<command id="449" name="play radio station {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
 <action>
   <cmdType>XJson.ExecBuiltin</cmdType>
   <cmdString>PlayMedia(plugin://plugin.audio.radio_de/station/{1})</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>VC.Pause</cmdType>
   <cmdString>4000</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>XJson.Raw</cmdType>
   <cmdString>GUI.SetFullscreen&amp;&amp;"fullscreen":"toggle"</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <phrase>play radio station</phrase>
 <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\rad_io_station_ids.xml</payloadFromXML>
</command>

Tecni

#6
Hi
i have a problem.On my HTPC the Command work but if i change the xbmc client (Rasbmc (XJson.SetConnection)) it dosnt open the stream.Radioaddon is aktiv.

I want to create a radio.pls , and the other Clients can open it with the normal XBMC Player.Hope you understand  what i want :biglaugh

can i scrape the the url after choose a radio station?

nime5ter

Quote from: jitterjames on October 11, 2013, 11:08:46 AM
It is also possible to get the actual streams from this site if you want to play the streams directly from something other than XBMC.  For example this link will give you details for the station ID: 8207 including the url of the stream which you can use in media monkey, itunes etc. or even play directly using VoxCommando's Sound.Playstream action.
http://www.rad.io/info/broadcast/getbroadcastembedded?broadcast=8207

As jitterjames says, you can get the stream URLs for individual radio stations manually. (For the above example, the streamUrl is http://stream.laut.fm/soundmania).

So, if you know the radio stations you want to stream, you could look up each one and then create a payloadXML where the value is the streamUrl and the phrase is the name of the radio station. Unfortunately, radio.de does not allow us to scrape this information automatically.

If you also want to play a random station from this list of streams, this should also be possible once the list has been defined.

I assume you know how to play a media stream in the regular XBMC player?
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)

jitterjames

#8
Quote from: Tecni on October 11, 2013, 11:31:55 AM
i have a problem.On my HTPC the Command work but if i change the xbmc client (Rasbmc (XJson.SetConnection)) it dosnt open the stream.Radioaddon is aktiv.

I don't know what you mean by "the command", but if it works on your htpc then you must have done something wrong setting up the rasbmc machine. Or maybe the raspbmx does not support that addon? Sorry, we can't help because you have provided no information other than "it doesn't work".

Kalle


QuoteYou can do this with a payload xml.  The command is actually much simpler.

Thanks James  :hugs
***********  get excited and make things  **********

Tecni

Schade das es nicht möglich ist die URL auszulesen.Also bleibt mir nur die Payload Methode über.
Ich benutze zurzeit das Script von Jitterhames http://voxcommando.com/forum/index.php?topic=1140.0 (bischen abgeändert)

Wie geh ich vor?
XML von jedem Genre erstellen und manuell die Streams einfügen?

Hier mal das Script

<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="Radio" enabled="False" prefix="" priority="0" requiredProcess="" description="">
  <command id="837" name="playRadioMatch" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="\\HTPC-PC\Users\Public\Music">
    <action>
      <cmdType>Scrape</cmdType>
      <cmdString>{Match.1}}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <cmdString>C:\Users\Public\Music\radio.pls&amp;&amp;{LastResult}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw/</cmdType>
      <cmdString>Player.Open&amp;&amp;"item":{"file":"smb:\\HTPC-PC\Users\Public\Music\radio.pls"}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Launch.OpenFile</cmdType>
      <cmdString>radio.pls</cmdString>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>File.=(.*)</cmdString>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>Sound.PlayStream</cmdType>
      <cmdString>{Match.1}</cmdString>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>Title.=\(.*?\)(.*)</cmdString>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>{Match.1} wird abgespielt</cmdString>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>{Match.1} wird abgespielt</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Standby</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>starte radio</phrase>
    <event>playRadioMatch</event>
  </command>
  <command id="798" name="shoutcast genre" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>VC.Standby</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Stop</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString>suche Radiosender {1}</cmdString>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>Scrape</cmdType>
      <cmdString>http://www.shoutcast.com/radio/{1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <cmdString>href="(.*?)".*?class="playbutton</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PY.ExecString</cmdType>
      <cmdString>import random</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PY.ExecString</cmdType>
      <cmdString>result = random.randint(1,{#M})</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <cmdString> {#M} Radiosender gefunden, spiele nummer {LastResult}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TriggerEvent</cmdType>
      <cmdString>playRadioMatch&amp;amp;&amp;amp;{LastResult}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Standby</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>shoutcast, inizialisiere radiowiedergabe</phrase>
    <phrase>genre, station</phrase>
    <payloadList>Alternative,Blues,Classical,Country,Decades,Easy Listening,Electronic,Metal,Oldies,New Age,Pop,Public Radio,Rap,Reggae,Rock,</payloadList>
  </command>
  <command id="799" name="stop stream" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Stop</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>SendKeys</cmdType>
      <cmdString>x</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Standby</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>stope radiowiedergabe</phrase>
  </command>
  <command id="833" name="stop stream schlafzimmer küche" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Stop</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Btn.KB</cmdType>
      <cmdString>x</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Standby</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>stope radiowiedergabe  schlafzimmer,stope radiowiedergabe küche</phrase>
  </command>
  <command id="839" name="Alle räume" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Scrape</cmdType>
      <cmdString>{Match.1}}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Write</cmdType>
      <cmdString>C:\Users\Public\Music\radio.pls&amp;&amp;{LastResult}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SetConnection</cmdType>
      <cmdString>192.168.178.33&amp;&amp;80</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw/</cmdType>
      <cmdString>Player.Open&amp;&amp;"item":{"file":"smb:\\HTPC-PC\Users\Public\Music\radio.pls"}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SetConnection</cmdType>
      <cmdString>192.168.178.31&amp;&amp;80</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw/</cmdType>
      <cmdString>Player.Open&amp;&amp;"item":{"file":"smb:\\HTPC-PC\Users\Public\Music\radio.pls"}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SetConnection</cmdType>
      <cmdString>192.168.178.92&amp;&amp;8080&amp;&amp;xbmc&amp;&amp;mario11111</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw/</cmdType>
      <cmdString>Player.Open&amp;&amp;"item":{"file":"smb:\\HTPC-PC\Users\Public\Music\radio.pls"}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Standby</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>starte radiowiedergabe in allen räume</phrase>
    <event>playRadioMatch</event>
  </command>
  <command id="851" name="Alle räume stop" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.SetConnection</cmdType>
      <cmdString>192.168.178.33&amp;&amp;80</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Btn.KB</cmdType>
      <cmdString>x</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SetConnection</cmdType>
      <cmdString>192.168.178.31&amp;&amp;80</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Btn.KB</cmdType>
      <cmdString>x</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SetConnection</cmdType>
      <cmdString>192.168.178.92&amp;&amp;8080&amp;&amp;xbmc&amp;&amp;mario11111</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>SendKeys</cmdType>
      <cmdString>x</cmdString>                                                   If i use XJson.Btn.KB on my HTPC XBMC FREEZES
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Standby</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>stope radiowiedergabe in allen räumen</phrase>
  </command>
</commandGroup>




Kalle

Ja genau, geht wohl nicht anders. Schau mir das nachher mal an.
***********  get excited and make things  **********

nime5ter

#12
Quote from: Tecni on October 12, 2013, 10:51:35 AM
Ich benutze zurzeit das Script von Jitterhames http://voxcommando.com/forum/index.php?topic=1140.0 (bischen abgeändert)

I don't know if this is the reason for all of your difficulties, but I can see several errors in the Shoutcast code. It looks like the code was not copied correctly. This may have been causing your initial problems.

The main problems are:

{Match.1}} should be {Match.{1}} in several places. [See the original code]

The "Shoutcast genre" command's VC.TriggerEvent action is probably not passing the parameter {LastResult} properly.

Your code says:

   <cmdString>playRadioMatch&amp;amp;&amp;amp;{LastResult}</cmdString>

But {LastResult} should be passed as the payload (i.e. the second parameter), not within the first parameter of the command string as it is currently in your code. In your code, VoxCommando is creating an event named "playRadioMatch&amp;amp;&amp;amp;[Random number]". In other words, it is not creating the event named "playRadioMatch" that you need to trigger the next command.

The code should be:

<?xml version="1.0" encoding="utf-16"?>
<command id="817" name="shoutcast genre" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
 <action>
   <cmdType>VC.Standby</cmdType>
   <cmdString />
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>TTS.Stop</cmdType>
   <cmdString />
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>TTS.Speak</cmdType>
   <cmdString>suche Radiosender {1}</cmdString>
   <cmdRepeat>0</cmdRepeat>
 </action>
 <action>
   <cmdType>Scrape</cmdType>
   <cmdString>http://www.shoutcast.com/radio/{1}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>Results.RegEx</cmdType>
   <cmdString>href="(.*?)".*?class="playbutton</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>PY.ExecString</cmdType>
   <cmdString>import random</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>PY.ExecString</cmdType>
   <cmdString>result = random.randint(1,{#M})</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>TTS.Speak</cmdType>
   <cmdString> {#M} Radiosender gefunden, spiele nummer {LastResult}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
action>
   <cmdType>VC.TriggerEvent</cmdType>
   <cmdString>playRadioMatch&amp;&amp;{LastResult}</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>VC.Standby</cmdType>
   <cmdString />
   <cmdRepeat>1</cmdRepeat>
 </action>
 <phrase>shoutcast, inizialisiere radiowiedergabe</phrase>
 <phrase>genre, station</phrase>
 <payloadList>Alternative,Blues,Classical,Country,Decades,Easy Listening,Electronic,Metal,Oldies,New Age,Pop,Public Radio,Rap,Reggae,Rock,</payloadList>
</command>



The problem with your stream not playing is because of the VC.TriggerEvent error. If you copy the above and paste it into your tree, replacing your current 'shoutcast genre' command, that should fix the streaming problem for shoutcast.

With regard to XBMC-related issues, I will leave that to others here. I don't use XBMC. :)
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)

Tecni

I have corrected it .Thanks



jitterjames

#14
I don't understand why you have switched back to shoutcast, rather than using the commands for the XBMC radio plug-in.

What is your ultimate goal?  Forget about the commands for now.  What do you want to be able to do?