Author Topic: xjson.raw command with new pandora addon "pandoki"  (Read 6487 times)

0 Members and 1 Guest are viewing this topic.

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
xjson.raw command with new pandora addon "pandoki"
« on: January 06, 2015, 04:22:38 PM »
UPDATE: THE NEXT TWO LINKS ARE THE FINISHED COMMANDS FOR THE "PANDOKI" (PANDORA) ADD-ON FOR XBMC/KODI AND THE 2ND LINK IS FOR JITTERJAMES PANDORA WITH ROBO BROWSER

"PANDOKI" GROUP
http://voxcommando.com/forum/index.php?topic=1950.msg16805#msg16805

PANDORA WITH ROBO BROWSER GROUP
http://voxcommando.com/forum/index.php?topic=1950.msg16811#msg16811
                                                                                                                                                                           

there is a new Pandora addon for XBMC called "Pandoki" http://forum.kodi.tv/showthread.php?tid=205547

with this addon you can launch based on station ID Im trying to get it to work with xJson.raw

this is the command you would use for calling an individual channel in your keyboard.xml
Code: [Select]
<f7>ActivateWindow(10025,plugin://plugin.audio.pandoki/?play=1234)</f7>I tested it and it does work, but i have 20+ stations and want to be able to call them all by name
plus make a command to add new stations to my list with out having to edit the keyboard.xml each time

so far I have tried different variations of the commands bellow, I'm able to launch pandoki, but not by station id
I also added a command to pull the info you need from the xbmc log file to a maptable called "Pandora"
In order to scrape the log you will have to fully exit xbmc

XBMC Pandoki group
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.1.0-->
<commandGroup open="True" name="xbmc pandoki" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="947" name="scraping xbmc log !!!! MUST EXIT XBMC TO RUN !!!!!" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>{Path.Appdata}\XBMC\xbmc.log</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>Notice:\splugin.audio.pandoki\sPlay\s\sOK\s(.*?)'(.*?)'</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.CreateTable</cmdType>
      <params>
        <param>Pandora</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Map.Set</cmdType>
      <params>
        <param>Pandora</param>
        <param>{Match.{i}.1}</param>
        <param>{Match.{i}.2}</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
  </command>
  <command id="927" name="pandoki test launch by station" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="ActivateWindow(10025,plugin://plugin.audio.pandoki/?play=1234)">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>Addons.ExecuteAddon</param>
        <param>"addonid": "plugin.audio.pandoki" , "options":{"play:6485":ture}</param>
      </params>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>Addons.ExecuteAddon</param>
        <param>"addonid": "plugin.audio.pandoki" , "options":{"play=6485":true}</param>
      </params>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>Addons.ExecuteAddon</param>
        <param>"addonid": "plugin.audio.pandoki/?play=1234" </param>
      </params>
      <cmdRepeat>0</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>Addons.ExecuteAddon</param>
        <param>"addonid": "plugin.audio.pandoki" </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
</commandGroup>

"pandoki test launch by station" has different ways I have tried but no luck

any help would be great
thanks

« Last Edit: January 09, 2015, 03:55:36 PM by PegLegTV »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #1 on: January 06, 2015, 06:34:58 PM »
The problem is that those 4 digit IDs don't appear to be usable in commands as is. The actual station IDs are much longer. The way that I found the correct IDs was to follow our old tried and true method mentioned in various threads here on the forum: I added a Pandoki radio station to my favourites, and then went to check out the Favourites.xml file to see what it said.

From that, I was able to follow the example of a different addon command that I'd figured out for someone a while back to create a command that plays individual Pandoki/Pandora radio stations. (See below.)

I scoured my Kodi files to find somewhere other than the Favourites file that might properly document those IDs to make our payload generation easier, but I had no luck with that. In the commands below, I've included one that allows you to generate a payload XML file from the Favourites file, so you'd have to add all your radio stations to your favourites -- temporarily at least -- in order to do that. Sorry I couldn't come up with a less awkward method.

Note: I'm using the file path for Kodi's favourites file -- if you have an older XBMC installation, you'll want to change the path to XBMC

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.3-->
<commandGroup open="True" name="Kodi Pandoki" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="830" name="Play pandoki radio station {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="I added the action to return to the home screen because I prefer that view, but it's not necessary.">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Queuing station: {PF.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>GUI.ActivateWindow</param>
        <param>"window": "music", "parameters": ["plugin://plugin.audio.pandoki/?play={1}","return"]</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>GUI.ActivateWindow</param>
        <param>"window": "home"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Play pandoki station</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">XbmcPayloads\PandokiRadioStations.xml</payloadFromXML>
  </command>
  <command id="942" name="Scrape stations from Favourites" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>PayloadXML.Clear</cmdType>
      <params>
        <param>XbmcPayloads\PandokiRadioStations.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>{Path.Appdata}\Kodi\userdata\favourites.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>&amp;amp;</param>
        <param>and</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.Replace</cmdType>
      <params>
        <param>&amp;apos;</param>
        <param>'</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>&lt;favourite\sname="(.*?)".*?pandoki..play=(.*?)&amp;quot</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.MatchToXML</cmdType>
      <params>
        <param>XbmcPayloads\PandokiRadioStations.xml</param>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Scrape stations from Favourites</phrase>
  </command>
  <command id="941" name="Go to Pandoki" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>Addons.ExecuteAddon</param>
        <param>"addonid": "plugin.audio.pandoki" </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Go to Pandoki, Show Pandoki library</phrase>
  </command>
</commandGroup>

The addon syntax you originally tried to use does allow us to navigate to the Pandoki plugin's page, which I think is still a useful command to have. But from there we'd have to navigate, press buttons etc. to play each station. That's doable, but it's definitely nicer to be able to ask for specific stations.
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: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #2 on: January 06, 2015, 09:31:58 PM »
Hark! I went back to the "documentation" (forum post) for this addon and figured out the syntax for the 4 digit station id after all.

I thought I'd tried this earlier, but I guess I must have screwed something up.

Anyhow the following works for the four-digit IDs, so you can scrape your Kodi or XBMC log file to generate the radio station payload XML. The problem there is of course that the log only shows whatever stations you played when last logged in, so unless you play all your stations, the payload XML will still be incomplete.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.3-->
<commandGroup open="True" name="Kodi Pandoki  take 2" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="942" name="Scrape stations from Kodi log" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>PayloadXML.NewFile</cmdType>
      <params>
        <param>XbmcPayloads\PandokiStations.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>PayloadXML.Clear</cmdType>
      <params>
        <param>XbmcPayloads\PandokiStations.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>{Path.Appdata}\Kodi\kodi.log</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>plugin.audio.pandoki\sPlay\s\sOK\s(.*?)'(.*?)'</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.MatchToXML</cmdType>
      <params>
        <param>XbmcPayloads\PandokiStations.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Scrape stations from Kodi log</phrase>
  </command>
  <command id="941" name="Play pandoki station" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Grab your 4 digit station IDs from the log file, in this case.">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Queuing Pandora station {PF.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>GUI.ActivateWindow</param>
        <param>"window":"music","parameters":["plugin://plugin.audio.pandoki/?play={1}"]</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>queue station</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">XbmcPayloads\PandokiStations.xml</payloadFromXML>
  </command>
</commandGroup>

I actually have another thought about how to get the full station IDs from Pandora directly, so I may revisit the first command set again.

(Yes, I like puzzles.)
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)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #3 on: January 06, 2015, 11:47:43 PM »
thanks for the commands, I've spent about 30min trying to find a list of my station id's by scraping the pandora site but no luck, the only way i can find all my station id's in one place, is by going to stations under my profile and right-click then click "view page source" i have scraped that URL with "scrape" but it leaves that section out  ???

i also noticed that if i listen to the same station multiple times while logged in it would be added to the payload multiple times when i scrape it, so scraping log file wont work unless there's a way for regex to see duplicates and remove them


again thanks

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #4 on: January 07, 2015, 08:24:54 AM »
thanks for the commands, I've spent about 30min trying to find a list of my station id's by scraping the pandora site but no luck, the only way i can find all my station id's in one place, is by going to stations under my profile and right-click then click "view page source" i have scraped that URL with "scrape" but it leaves that section out  ???

i also noticed that if i listen to the same station multiple times while logged in it would be added to the payload multiple times when i scrape it, so scraping log file wont work unless there's a way for regex to see duplicates and remove them


again thanks

If you can get all sation IDs that way, then copy the source to a text file and use the regex on that.

If you prefer to keep using the log method then you can use a map table and export the map to a payload xml. This will get rid of duplicates.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #5 on: January 07, 2015, 01:19:36 PM »
thanks for the commands, I've spent about 30min trying to find a list of my station id's by scraping the pandora site but no luck,

This is a job for RoboBrowser, rather than a regular scrape. Actually, with RoboBrowser, those who want to can interact with Pandora directly if they don't want to run XBMC.

James is working on a set of commands now for that. You will still be able to use the one "scrape Pandora stations" command to generate your xml for XBMC if you prefer to continue using Pandoki, so it should be a flexible option for different people's preferences.
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)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #6 on: January 07, 2015, 02:18:01 PM »
If you can get all sation IDs that way, then copy the source to a text file and use the regex on that.

If you prefer to keep using the log method then you can use a map table and export the map to a payload xml. This will get rid of duplicates.

sweet thanks, :D that works great to remove duplicates, and also keeps all stations that haven't been played recently so the payload stays up to date with what i have.   ::wiggle

This is a job for RoboBrowser, rather than a regular scrape. Actually, with RoboBrowser, those who want to can interact with Pandora directly if they don't want to run XBMC.

James is working on a set of commands now for that. You will still be able to use the one "scrape Pandora stations" command to generate your xml for XBMC if you prefer to continue using Pandoki, so it should be a flexible option for different people's preferences.

i like the idea of doing this as well Because the addon's don't always work as wanted (sometimes the audio cuts out untill the next song starts) I use Pandora for my "good night" command and my alarm clock, so if i do the RoboBrowser way ill have to see if i can make the screen on my tv go fully black with my ir blaster so the room stays dark  ::banana

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #7 on: January 07, 2015, 03:57:31 PM »
after deleting a radio station and looking threw the log i found that the add-on outputs the station name and ID that was deleted
Code: [Select]
NOTICE: plugin.audio.pandoki Delete   9173 'Radioactive Radio'so I'm wondering if there is a way to remove that specific key and value from a map table with a command?

Thanks

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 2009
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #8 on: January 07, 2015, 04:03:35 PM »
Yes, you can delete a map key/value using Map.Query. See http://voxcommando.com/forum/index.php?topic=1649.msg14354#msg14354
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)

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #9 on: January 07, 2015, 04:24:59 PM »
sweet thanks, must have been using the wrong search terms, never saw that post

Thanks

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #10 on: January 07, 2015, 06:29:06 PM »
here is the pandoki group i made to work with XBMC/KODI 

once you add the command to VC you will want to execute "create Pandora Map First" command

then i would play each station you have for a couple seconds so you can add all of your stations, once you are done with that say

"update Pandoki Radio Stations"
this command will copy your xbmc.log to your vc folder then find all the stations and add them to the "Pandora" Map table then create "PandokiRadioStations.xml" in your xbmc payloads folder then delete xbmc.log from your vc folder, any time you add or delete a radio station form Pandoki addon use this command to update the xml and Map table

"XBMC PANDOKIE"
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.0.1.0-->
<commandGroup open="True" name="XBMC pandoki" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="998" name="Create Pandora Map First" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Run this first to creat the map table ">
    <action>
      <cmdType>Map.CreateTable</cmdType>
      <params>
        <param>Pandora</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
  <command id="995" name="update Pandoki Radio Stations" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="first time you run this i would go through and listen to all of your radio stations so there in the log file&#xD;&#xA;&#xD;&#xA;then after that any time you play a new station or delete a station you can run this and it will update the map and paylod.xml">
    <action>
      <cmdType>File.Copy</cmdType>
      <params>
        <param>{Path.Appdata}\XBMC\xbmc.log</param>
        <param>{Path.VC}\xbmc.log</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>{Path.VC}\xbmc.log</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>Notice:\splugin.audio.pandoki(.*?) \d\d\d\d\s'</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{LastResult}&amp;&amp;Play</ifParams>
      <then>
        <action>
          <cmdType>Results.RegEx</cmdType>
          <params>
            <param>Notice:\splugin.audio.pandoki\sPlay\s\sOK\s(.*?)\s'(.*?)'</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Set</cmdType>
          <params>
            <param>Pandora</param>
            <param>{Match.{i}.1}</param>
            <param>{Match.{i}.2}</param>
          </params>
          <cmdRepeat>{#M}</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{LastResult}&amp;&amp;Delete</ifParams>
      <then>
        <action>
          <cmdType>Results.RegEx</cmdType>
          <params>
            <param>Notice:\splugin.audio.pandoki\sDelete\s\s\s(.*?)\s'(.*?)'</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Map.Query</cmdType>
          <params>
            <param>delete from Pandora where fromKey="{Match.{i}.1}"</param>
          </params>
          <cmdRepeat>{#M}</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <action>
      <cmdType>Map.ExportPayloadXML</cmdType>
      <params>
        <param>XbmcPayloads\PandokiRadioStations.xml</param>
        <param>Pandora</param>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>File.Delete</cmdType>
      <params>
        <param>{Path.VC}\xbmc.log</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Pandoki Radio Stations Updated</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Group.Rebuild</cmdType>
      <params>
        <param>XBMC pandoki</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>update Pandoki Radio Stations</phrase>
  </command>
  <command id="948" name="Play pandoki radio station {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="I added the action to return to the home screen because I prefer that view, but it's not necessary.">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Queuing station: {PF.1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>GUI.ActivateWindow</param>
        <param>"window": "music", "parameters": ["plugin://plugin.audio.pandoki/?play={1}","return"]</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>GUI.ActivateWindow</param>
        <param>"window": "home"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Play pandoki station</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">XbmcPayloads\PandokiRadioStations.xml</payloadFromXML>
  </command>
  <command id="1005" name="What pandoki stations do i have?" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>File.Read</cmdType>
      <params>
        <param>{Path.VC}\XbmcPayloads\PandokiRadioStations.xml</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>&lt;phrase&gt;(.*?)&lt;/phrase&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.MatchConcat</cmdType>
      <params>
        <param>, </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Pandoki Radio Stations:</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.AddText</cmdType>
      <params>
        <param>{LastResult}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <params>
        <param>here is a list of your pandoki radio stations</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <params>
        <param>{Match.{i}.1}</param>
      </params>
      <cmdRepeat>{#M}</cmdRepeat>
    </action>
    <phrase>What pandoki stations do i have</phrase>
  </command>
  <command id="975" name="Go to Pandoki" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <params>
        <param>Addons.ExecuteAddon</param>
        <param>"addonid": "plugin.audio.pandoki" </param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Go to Pandoki, Show Pandoki library</phrase>
  </command>
</commandGroup>

you can also ask "What pandoki stations do i have?" and it will list them with osd and read the list to you

if you are using KODI you will need to correct the file paths and log names in the "update Pandoki Radio Stations" command

thanks, nime5ter & jitterjames for all the help  ::banana

EDIT: found an issue with the "What pandoki stations do i have?" command once I had all my stations added so I updated the code above with the fixed command


« Last Edit: February 21, 2015, 02:46:59 PM by PegLegTV »

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #11 on: January 07, 2015, 06:48:20 PM »
+1  8)

I will post a roboBrowser group soon.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #12 on: January 07, 2015, 11:13:03 PM »
Here it is.  I am using two groups, because I want to be able to quickly rebuild one group after scanning stations, and in the other group I am using a payload with all my artists from MediaMonkey in it, which I don't want to rebuild each time.

The first time you use the connect command you will need to enter your credentials.  Be sure to check "remember me on this computer" (or whatever it says) so that next time you won't have to do it.

You can create new stations using your artist xml from another configuration.  I am using a payload from MediaMonkey, but you could use any artist xml, or even try dictation.  I found Pandora to be a bit jerky in creating new stations and sometimes this command does not work for some reason.

Almost all my phrases start with Pandora because I have a lot of other commands and I did not want to get them mixed up.  You can start with "Pandora show help"

Make sure you copy both groups to your tree.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.3-->
<commandGroup open="False" name="Pandora Radio RoboB" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="239" name="Pandora connect" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Navigate</cmdType>
      <params>
        <param>http://www.pandora.com/</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Show</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pandora connect</phrase>
  </command>
  <command id="214" name="Pandora show help" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>Help.ShowByName*</cmdType>
      <params>
        <param>Pandora</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pandora show help</phrase>
  </command>
  <command id="234" name="Terminate pandora" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Dispose</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Okay. If you change your mind say: "pandora connect"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Terminate pandora</phrase>
  </command>
  <command id="262" name="Pandora pause" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <params>
        <param>div</param>
        <param>^&lt;div.class="pauseButton</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Click</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pandora pause</phrase>
  </command>
  <command id="315" name="Pandora unpause" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <params>
        <param>div</param>
        <param>^&lt;div.class="playButton</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Click</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pandora</phrase>
    <phrase>unpause, play</phrase>
  </command>
  <command id="317" name="Pandora skip" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <params>
        <param>div</param>
        <param>^&lt;div.class="skipButton</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Click</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pandora</phrase>
    <phrase>skip</phrase>
  </command>
  <command id="331" name="Pandora thumbs up" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <params>
        <param>div</param>
        <param>^&lt;div.class="thumbUpButton</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Click</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pandora</phrase>
    <phrase>thumbs up, I love this song</phrase>
  </command>
  <command id="351" name="Pandora thumbs down" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <params>
        <param>div</param>
        <param>^&lt;div.class="thumbUpButton</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Click</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pandora</phrase>
    <phrase>Thumbs up, This song sucks</phrase>
  </command>
  <command id="287" name="Pandora create station for artist {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="Uses keyboard emulation in order to get the javascript to fire correctly, so the RoboB window must be shown!">
    <action>
      <cmdType>Window.Focus</cmdType>
      <params>
        <param>VoxCommando</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Show</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <params>
        <param>input</param>
        <param>^&lt;input.class="searchInput"</param>
        <param />
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Focus</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>InputKeys.TextEntry</cmdType>
      <params>
        <param>{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <params>
        <param>Are you sure you want to create this station?</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Are you sure you want to create this station?</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.TellVox</cmdType>
      <params>
        <param>confirm artist create</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pandora </phrase>
    <phrase>create, create new</phrase>
    <phrase>station</phrase>
    <phrase>for artist</phrase>
    <payloadFromXML phraseOnly="True" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">mmPayloads\MMAlbumArtists.xml</payloadFromXML>
  </command>
  <command id="346" name="confirm artist create (called automatically)" enabled="true" alwaysOn="False" confirm="True" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="The user does not say this command, it is triggered by a tellVox action in the command to create an artist station.">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <params>
        <param>input</param>
        <param>^&lt;input.class="searchInput"</param>
        <param />
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Focus</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>InputKeys.Send</cmdType>
      <params>
        <param>{ENTER}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>confirm artist create</phrase>
  </command>
</commandGroup>

Second group:
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.3.3-->
<commandGroup open="False" name="Pandora Radio play station" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="302" name="Pandora play station {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Navigate</cmdType>
      <params>
        <param>http://www.pandora.com/station/play/{1}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pandora play station</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\PandoraStations.xml</payloadFromXML>
  </command>
  <command id="295" name="++Pandora scrape my stations" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Please stand by</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Select</cmdType>
      <params>
        <param>PandoraRadio</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementRegex</cmdType>
      <params>
        <param>div</param>
        <param>^&lt;div.class="myprofile_icon"</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Click</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Pause</cmdType>
      <params>
        <param>1000</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementByID</cmdType>
      <params>
        <param>profile_tab_stations</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.Click</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Pause</cmdType>
      <params>
        <param>4000</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.ElementByID</cmdType>
      <params>
        <param>stations</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>RoboB.GetHTML</cmdType>
      <params />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.RegEx</cmdType>
      <params>
        <param>&lt;a.href="/station/(\d*)"&gt;(.*?).Radio&lt;/a&gt;</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.Speak</cmdType>
      <params>
        <param>Found {#M} stations</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Results.MatchToXML</cmdType>
      <params>
        <param>payloads\PandoraStations.xml</param>
        <param>False</param>
        <param>True</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>Group.Rebuild</cmdType>
      <params>
        <param>Pandora Radio play station</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Pandora scrape my stations</phrase>
  </command>
</commandGroup>

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 499
  • Karma: 43
    • View Profile
Re: xjson.raw command with new pandora addon "pandoki"
« Reply #13 on: January 08, 2015, 12:30:18 AM »
+1 as well  8) works great, also after looking through your build I noticed I forgot to add the rebuild action in  :bonk so I added it above, I'll have to see if i can make my TV Screen go to sleep so I can use it for my good night and alarm command