Author Topic: creating a command for using internet radio  (Read 2787 times)

0 Members and 2 Guests are viewing this topic.

2exclusive

  • Contributor
  • ***
  • Posts: 54
  • Karma: 0
    • View Profile
creating a command for using internet radio
« on: September 29, 2014, 05:20:22 PM »
Hi guys,

I'm a newbie here and would like some help trying to create a VC Internet Radio cmd

so i would like to ask voxcommando "Listen to Radio"

VC responds "which radio station would you like to listen to?" (would like VC to wait until hears my response)

VC would have a list of all the radio stations that I have predefined with corresponding url's. EX, z100, power 105.1 etc

I can also say "what are my options?" and VC will tell me all radio stations i have predefined.

I also have URL's to the the radio stations I like, but it requires a click on play button to start live radio. How do i get VC to execute the play button? URL- http://www.iheart.com/live/z100-1469/

once radio starts I would like VC to say "You are now listening to (StationName)"

the end.

any help on this i would appreciate it.. thanks guys

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: creating a command for using internet radio
« Reply #1 on: September 29, 2014, 06:07:45 PM »
I think you will find a lot of stuff here: http://voxcommando.com/forum/index.php?topic=1140.0
***********  get excited and make things  **********

2exclusive

  • Contributor
  • ***
  • Posts: 54
  • Karma: 0
    • View Profile
Re: creating a command for using internet radio
« Reply #2 on: September 29, 2014, 08:44:42 PM »
Yes, I saw this but I don't care to scrape the site. Just click play on the site. Would also like the sequence with wait Until I say a radio station.

Thanks for the reply

2exclusive

  • Contributor
  • ***
  • Posts: 54
  • Karma: 0
    • View Profile
Re: creating a command for using internet radio
« Reply #3 on: September 29, 2014, 11:29:03 PM »
So I made some progress, I was able to look through the html and find a url with the autostart link in it. so no need for the click to play

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: creating a command for using internet radio
« Reply #4 on: September 30, 2014, 05:37:05 AM »
Next I recommend you to take a look on our WiKi video tutorials under "Core Concepts", this will help you a lot to create the commands above.

http://voxcommando.com/mediawiki/index.php?title=Video_Tutorials

And the rest you will find here: http://voxcommando.com/forum/index.php?topic=1140.0
« Last Edit: September 30, 2014, 08:05:51 AM by jitterjames »
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: creating a command for using internet radio
« Reply #5 on: September 30, 2014, 08:23:24 AM »
so i would like to ask voxcommando "Listen to Radio"

VC responds "which radio station would you like to listen to?" (would like VC to wait until hears my response)

Almost by definition, VoxCommando works by waiting for you to issue a voice command.

While you might think of your command as a "response", it's important to mentally accept that VC doesn't genuinely engage in conversation. You say something; it responds with one particular command; you say something back; it will respond using a different command.

You specify what happens in each commmand. If you want a command where you say, "Listen to radio" and VC says, "Which station would you like to listen to?" but does nothing else, then that's the command you should create.

Then you create another command where you say, "Play radio station {x}". In that command macro, VC processes the instructions for how to start playing the stream you want to hear, and to announce the name of the station to you.

Quote
VC would have a list of all the radio stations that I have predefined with corresponding url's. EX, z100, power 105.1 etc

These are known as value/phrase payload XML files. You can learn about them on the wiki and in the videos specified above. http://voxcommando.com/mediawiki/index.php?title=Payloads. The videos on editing commands are a must watch.

Be careful with how you write your radio station names. I'm not sure, but you may want to write out "power 105 point 1" for your phrase. You can test it for yourself.

Quote
I can also say "what are my options?" and VC will tell me all radio stations i have predefined.

Here, you would again use the payload XML file that you're using in the other command. VC would simply list the phrases in that file. Or you could specify that you only want 5 random stations, etc.

Here is a sample command group to get you started.  For the method I've chosen to use, you'll need to enable the RoboBrowser plugin in Options.

If you don't know how to copy this into your command tree, see: http://voxcommando.com/mediawiki/index.php?title=XML_on_the_forum

I've also attached the payload XML file that I'm using in this example, which should go in the payloads folder of your VC directory.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.0.3-->
<commandGroup open="True" name="I heart internet radio" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="336" name="Listen to radio" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Which radio station would like to to listen to?|What station did you have in mind?|Sure, I can turn on the radio. What station should I tune to?</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Listen to radio</phrase>
  </command>
  <command id="332" name="Play station {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="This command uses the auto play URL to start playing the stream. &#xD;&#xA;&#xD;&#xA;The &quot;0&quot; lines show an alternative; they show how you could have clicked on the play button.&#xD;&#xA;&#xD;&#xA;If you want to see the browser window, change the &quot;RoboB.Show&quot; line from 0 to 1.&#xD;&#xA;">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>radio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Navigate</cmdType>
      <params>
        <param>{1}/?autoplay=true</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Show</cmdType>
      <params />
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Wait</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <params>
        <param>i</param>
        <param> class="icon-play"</param>
      </params>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Click</cmdType>
      <params />
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>You're listening to {PF.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Play station, play</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\iheartradio_channels.xml</payloadFromXML>
  </command>
  <command id="339" name="Stop the radio" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="This command stops a stream using the mouse click method, but leaves the RoboB object &quot;radio&quot; alive. You could instead delete all those lines, and activate the &quot;RoboB.Dispose&quot; line. That will kill the current RoboB, thus killing the radio stream.">
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <params>
        <param>i</param>
        <param> class="icon-stop"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Click</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Dispose</cmdType>
      <params />
      <cmdRepeat>0</cmdRepeat>
    </action>
    <phrase>Stop the radio, stop playing this station</phrase>
  </command>
  <command id="312" name="What are my options?" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="This is the easiest method but not the most sophisticated. There are almost always different ways to skin a cat in VC.">
    <action>
      <cmdType>PayloadXML.GetRandomP</cmdType>
      <params>
        <param>payloads\iheartradio_channels.xml</param>
        <param>100</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.MatchConcat</cmdType>
      <params>
        <param>{CR}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>What are my options?</phrase>
  </command>
</commandGroup>
« Last Edit: September 30, 2014, 10:50:50 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)

2exclusive

  • Contributor
  • ***
  • Posts: 54
  • Karma: 0
    • View Profile
Re: creating a command for using internet radio
« Reply #6 on: September 30, 2014, 09:04:21 AM »
thanks a bunch this really helps, you guys are awesome  :clap

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: creating a command for using internet radio
« Reply #7 on: September 30, 2014, 10:53:44 AM »
Maybe you figured this out already and fixed it for yourself, but I originally forgot to include a command phrase for the "Listen to radio" command.

That is: I told it what it should do, but forgot to tell it what to listen for.

I've now edited the xml above to fix that error (and some typos).
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)

2exclusive

  • Contributor
  • ***
  • Posts: 54
  • Karma: 0
    • View Profile
Re: creating a command for using internet radio
« Reply #8 on: September 30, 2014, 09:34:18 PM »
Working great , thanks again