Author Topic: Launching Kodi favorite - addon  (Read 8742 times)

0 Members and 4 Guests are viewing this topic.

carlh1

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Launching Kodi favorite - addon
« on: July 12, 2015, 03:19:02 PM »
I'm trying to make a morning wakeup routine. When I say "good morning" i want it to say some things and then ask if I want to listen to some jazz. It would be in my favorites. It's jazzradio.com and the station is "smooth jazz".

I'm trying to use "XJson.Raw" with "Addons.ExecuteAddon" but I don't really understand the parameters after that, the example I've seen uses "addon":{1} I tried using "addon":"Jazzradio.com" but it didn't work.

I would rather just pass it the id of the favorite... would that work?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Launching Kodi favorite - addon
« Reply #1 on: July 12, 2015, 04:49:28 PM »
Every Addon is different, though many follow the same general approach.  Some need to be "opened" (Gui.ActivateWindow) and some need to be "executed" as you have tried...  There may be another variant. I'm not sure.  Some can take parameters and some can't, and if they can, then the format will often vary.

There are two general approaches you can take to try to figure this out.  The first is for simple stuff like just launching an addon without going to any sub pages or using any parameters.

1 - Create a favourite for the item that you want to open and then go to your %appdata%\kodi\userdata and open the favourites.xml file

2 - This method is a bit trickier but can allow you to do more difficult things like figuring out how to pass parameters.  Instead of creating a favourite, enable logging in Kodi, then navigate to the plugin and perform whatever action you want to automate.  Then look in the Kodi log.

Either way, feel free to post your favourites.xml file or the pertinent section of your Kodi log, if you want help on how to convert that into a valid action for VoxCommando.  We will be happy to help you figure it out. :)

Here's a post where I used method #2.  Hopefully it will give you an idea:
http://voxcommando.com/forum/index.php?topic=2236.msg19395#msg19395

carlh1

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #2 on: November 01, 2015, 11:45:19 PM »
James,

Would you still be willing to help me with this? I have played with this but it's got me stumped. I can sent my kodi log if that helps. I'm trying to get vox to activate a favorite in Kodi, or at least launch a specific station in the icecast plugin. Ultimately i wan to be able to say "play jazz", "play rock", etc and have it go to a station I like.


PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #3 on: November 02, 2015, 12:38:59 AM »
If you post your Favorites.xml I can take a look at it and see what I can come up with   

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Launching Kodi favorite - addon
« Reply #4 on: November 02, 2015, 07:44:04 AM »
To attach a file to your forum post, click on the "Attachments and other options" link that appears below the text box.

Then you'll be able to choose a file from your computer to upload as an attachment to your post.
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)

carlh1

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #5 on: November 03, 2015, 12:56:45 AM »
Attached.

This is the one I'd like to start with: "http://pub2.jazzradio.com:80/jr_smoothjazz"

Thanks.


PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #6 on: November 03, 2015, 11:03:39 AM »
this Command Should launch your Smooth Jazz Station

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<commandGroup open="True" name="JazzRadio.com" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="689" name="JazzRadio.com - Launch Smooth Jazz" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw/</cmdType>
      <params>
        <param>Player.Open</param>
        <param>"item": {"file":"http://pub2.jazzradio.com:80/jr_smoothjazz"}</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
  </command>
</commandGroup>

carlh1

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #7 on: November 11, 2015, 11:51:49 PM »
It seem I cant do much on my own... the code you suggested is working if I put in the test payload values... but when I speak the phrase Kodi gets it and acts like it wants to run it, but nothing happens. Here's my code:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.5-->
<command id="-1" name="Actions copied from LCB">
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;play some jazz please</ifParams>
    <then>
      <action>
        <cmdType>XJson.Raw</cmdType>
        <params>
          <param>Player.Open</param>
          <param>"item": {"file":"http://pub2.jazzradio.com:80/jr_smoothjazz"}</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <if ifBlockDisabled="False" ifNot="False">
    <ifType>(A)Contains(B)</ifType>
    <ifParams>{1}&amp;&amp;no jazz this morning thanks</ifParams>
    <then>
      <action>
        <cmdType>TTS.Speak</cmdType>
        <params>
          <param>OK, I hope you have a nice morning!</param>
        </params>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>VC.StopMacro</cmdType>
        <params />
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
</command>

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #8 on: November 12, 2015, 12:03:51 AM »
From what you shared its hard to tell what could be going wrong, I tested it by simply putting the phrases payload values in the payload testing area at the bottom of the command and they both worked,

if you can share the command(s) that go with it so we can fully test it and see what could be going wrong
« Last Edit: November 12, 2015, 07:52:03 AM by jitterjames »

carlh1

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #9 on: November 12, 2015, 12:23:07 AM »
i have it under a group called "time of day" and the command is "morning setup". There are two command phrases, one is optional "yes, no" and one isn't optional "play some jazz please, jazz this morning thanks". I've attached the vox log. The play some jazz please should launch the jazz station. it looks like it's doing something in the log.

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Launching Kodi favorite - addon
« Reply #10 on: November 12, 2015, 07:27:12 AM »
Unfortunately, the command xml you shared doesn't help us because it doesn't appear to be the full command (i.e., there's no voice or event triggers to set off that command, so no payloads can be passed to it).

Can you please share the xml for the whole group you've described above?

You can right click on the group folder to export the group xml, and then attach that xml here.

Thanks.
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

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Launching Kodi favorite - addon
« Reply #11 on: November 12, 2015, 07:49:56 AM »
Or you can copy and paste a group into a code box the same way you do with a command.

carlh1

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #12 on: November 12, 2015, 09:43:27 PM »
Here you go:

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.1.4.5-->
<commandGroup open="True" name="Time of day" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="358" name="morning startup" enabled="true" alwaysOn="True" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{1}&amp;&amp;play some jazz please</ifParams>
      <then>
        <action>
          <cmdType>XJson.Raw</cmdType>
          <params>
            <param>Player.Open</param>
            <param>"item": {"file":"http://pub2.jazzradio.com:80/jr_smoothjazz"}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{1}&amp;&amp;no jazz this morning thanks</ifParams>
      <then>
        <action>
          <cmdType>TTS.Speak</cmdType>
          <params>
            <param>OK, I hope you have a nice morning!</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <phrase optional="true">yes, no</phrase>
    <phrase>play some jazz please,  jazz this morning thanks</phrase>
  </command>
</commandGroup>

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #13 on: November 12, 2015, 10:06:28 PM »
in the command that you shared you where using {1} when you don't have any payloads, for this command you need to use {LastSpoken}
also you had "yes,no" set to optional so the command would still try and run, but couldn't because of your if statements, So I changed "Yes, No" to a payload list and changed your if statements


this command has the required fixes and should work
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.0.9-->
<commandGroup open="True" name="Time of day" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="396" name="morning startup" enabled="true" alwaysOn="True" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{1}&amp;&amp;Yes</ifParams>
      <then>
        <action>
          <cmdType>XJson.Raw</cmdType>
          <params>
            <param>Player.Open</param>
            <param>"item": {"file":"http://pub2.jazzradio.com:80/jr_smoothjazz"}</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>(A)Contains(B)</ifType>
      <ifParams>{1}&amp;&amp;No</ifParams>
      <then>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <params>
            <param>OK, I hope you have a nice morning!</param>
          </params>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>VC.StopMacro</cmdType>
          <params />
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <payloadList>Yes, No</payloadList>
    <phrase>play some jazz please, jazz this morning thanks</phrase>
  </command>
</commandGroup>



« Last Edit: November 13, 2015, 10:27:33 AM by PegLegTV »

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Launching Kodi favorite - addon
« Reply #14 on: November 12, 2015, 10:08:42 PM »
I think the easier solution -- and one that will apply to many command situations -- is for him to use payload phrases.

@carlh1. The problem is that you're not passing any payloads to the macro.

You need to use a payload list rather than regular phrases for your two non-optional voice commands.

http://voxcommando.com/mediawiki/index.php?title=Command_Tree_Editor
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)