News:

HOT TIP! Exploring the commands packaged in VC's standard configurations is a great way to learn how to build your own. You can also clone a command as a starting point: just right-click and select "Clone" (or type Alt-C).

Main Menu

Internet Radio

Started by jitterjames, July 16, 2013, 11:41:20 AM

Previous topic - Next topic

0 Members and 2 Guests are viewing this topic.

StrikemanXL

Thanks JJ that worked a treat and the new VC version works great :) thank you.
I found this to open .pls files in WMP http://openplsinwmp.codeplex.com/

jitterjames

#16
Thanks.  I believe both MediaMonkey and iTunes can open them without modification.

nime5ter

FWIW, on my Windows 8 machine I had no difficulty getting the code to work, streaming using MediaMonkey, but when I tried to add a Stop Stream command (MM.Stop or MM.Pause etc.) I got an error and could not get the stream to stop.

I was able to fix the problem by setting both Media Monkey and VC to "run as administrator". If you're having similar difficulties, give this a whirl.

I am using VC 1.1.4.0, but had the same issue when I tried using an earlier 1.1x version (I forget which).
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

#18
I believe this is an issue with the MediaMonkey com library that VC uses to communicate with MediaMonkey.  It seems to behave differently on different systems, but the problem actually has nothing to do with streaming audio in particular.  If you try any command from VC to control MediaMonkey you will have this issue.

On my various windows systems (including a win8.1 preview) I have not had this problem even with UAC turned on.  I only needed to run MM once as administrator and from then on no problems, and I never have to run VC as admin.  I don't know why your system is different but seeing is believing!

Tecni

#19
 Hi,I try modify the script for radio.de but dosnt work. Need a little bit help ^^ with Results.RegEx action. Ty

<?xml version="1.0" encoding="utf-16"?>
<command id="333" name="radioscrape" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
 <action>
   <cmdType>Scrape</cmdType>
   <cmdString>http://www.radio.de/#%2Fsendersuche.jsf%3Fq%3D{1}%26u%3Dall</cmdString>
   <cmdRepeat>1</cmdRepeat>
 </action>
</command>


Kalle

Hi Tecni and welcome to VC forum.
I'm not sure which script you mean (there are more then one script in this topic)  ;)
You can post a VC command group by using the square icon above (#), so we can take a look on it.
***********  get excited and make things  **********

Tecni

#21
I want use this script for radio.de

<?xml version="1.0" encoding="utf-16"?>
<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>Scrape</cmdType>
   <cmdString>http://www.shoutcast.com/radio/{1}</cmdString>      (for radio.de <cmdString>http://www.radio.de/#%2Fsendersuche.jsf%3Fq%3D{1}%26u%3Dall</cmdString> )
   <cmdRepeat>1</cmdRepeat>
 </action>
 <action>
   <cmdType>Results.RegEx</cmdType>
   <cmdString>href="(.*?)".*?class="playbutton</cmdString>             (dont know... tried  id )
   <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 radio</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>

nime5ter

#22
I'm happy to help you with the regex, but since the site you are using works differently from shoutcast, you'll have to do more than get the regex right for this command to work properly.

To return a list of URL matches for the genre of radio stations you've asked for, you can use the regex:cmdType>Results.RegEx</cmdType>
   <cmdString>linkobject=.*url\'\:\'(.*?)\'.*?bcastid=</cmdString>
   <cmdRepeat>1</cmdRepeat>


(This is when scraping the URL that you provided for us: http://www.radio.de/#%2Fsendersuche.jsf%3Fq%3D{1}%26u%3Dal )

However, the rest of James's original command group is designed to work with .pls multimedia playlists, whereas your site uses a built-in Flash player for each radio station.

You can still use the above regex to get the station URLs, but I imagine you'll want to use the Launch.URL action or something like that to open one of those matches in your browser. The challenge will be in finding a way to return a random match from the list of URLs.

Let us know if you'd like more help with that. It might be fun to try on your own first, so I am just answering the question that you initially posed. :)
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

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

Here is a group of commands that work with rad.io (and radio.de with minor adjustment) but you will need VC version 1.163 for it to work.

<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="scrape rad io" enabled="True" prefix="" priority="0" requiredProcess="" description="">
 <command id="1120" name="radio play genre {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
   <action>
     <cmdType>Scrape.UserAgent</cmdType>
     <cmdString>http://www.rad.io/info/menu/broadcastsofcategory?category=_genre&amp;value={1}&amp;&amp;VoxCommando</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>Results.RegEx</cmdType>
     <cmdString>"id":(.*?),</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <if ifBlockDisabled="False" ifNot="True">
     <ifType>LastActionSuccess</ifType>
     <ifParams>&amp;&amp;</ifParams>
     <then>
       <action>
         <cmdType>TTS.Speak</cmdType>
         <cmdString>Error.</cmdString>
         <cmdRepeat>1</cmdRepeat>
       </action>
       <action>
         <cmdType>VC.StopMacro</cmdType>
         <cmdString />
         <cmdRepeat>1</cmdRepeat>
       </action>
     </then>
     <else />
   </if>
   <action>
     <cmdType>Results.SetVar</cmdType>
     <cmdString>radioID&amp;&amp;{Match.Rnd}</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>Scrape.UserAgent</cmdType>
     <cmdString>http://www.rad.io/info/broadcast/getbroadcastembedded?broadcast={Var.radioID}&amp;&amp;VoxCommando</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>Results.RegEx</cmdType>
     <cmdString>"(?:streamUrl|name|description)":"(.*?)"</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>OSD.ShowText</cmdType>
     <cmdString>Now Playing {Match.3}, {Match.2}</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>Sound.PlayStream</cmdType>
     <cmdString>{Match.1}</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>Sound.SetStreamVol</cmdType>
     <cmdString>50</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>TTS.Speak</cmdType>
     <cmdString>Now Playing {Match.3}, {Match.2}</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <phrase>radio play genre</phrase>
   <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\RadioGenres.xml</payloadFromXML>
 </command>
 <command id="1101" name="set stream volume" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
   <action>
     <cmdType>Sound.SetStreamVol</cmdType>
     <cmdString>{1}</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <phrase>set stream volume</phrase>
   <payloadList>10,20,30,40,50,60,70,80,90,100</payloadList>
 </command>
 <command id="1116" name="what radio station is this" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
   <action>
     <cmdType>Sound.GetStreamInfo</cmdType>
     <cmdString />
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>Results.RegEx</cmdType>
     <cmdString>name:(.*)</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>OSD.ShowText</cmdType>
     <cmdString>{Match.1}</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>TTS.Speak</cmdType>
     <cmdString>You are listening to: {Match.1}</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <phrase>what radio station is this</phrase>
 </command>
 <command id="1134" name="sound.getstreaminfo" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
   <action>
     <cmdType>OSD.SetFontSize</cmdType>
     <cmdString>14</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>Sound.GetStreamInfo</cmdType>
     <cmdString />
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>OSD.ShowText</cmdType>
     <cmdString>{LastResult}&amp;&amp;6000&amp;&amp;-100</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
   <action>
     <cmdType>System.SetClipboardText</cmdType>
     <cmdString>{LastResult}</cmdString>
     <cmdRepeat>1</cmdRepeat>
   </action>
 </command>
 <command id="188" name="radio stop" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
   <action>
     <cmdType>Sound.StopStream</cmdType>
     <cmdString />
     <cmdRepeat>1</cmdRepeat>
   </action>
   <phrase>radio stop</phrase>
 </command>
</commandGroup>

Tecni

Thanks  :) :) i test it later.

jitterjames


Tecni

#27
Works well.Thanks

Is it possible to write the url in a pls data? ::)

Kalle

create as new from the post above

Is it possible to write the url in a pls data? Roll Eyes
***********  get excited and make things  **********

jitterjames

Was that supposed to be a bump?

The answer is yes.

A more detailed question will result in a more detailed answer.  >:D