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

0 Members and 6 Guests are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Launching Kodi favorite - addon
« Reply #15 on: November 12, 2015, 10:11:30 PM »
There are always many ways to do things in VC.

In this case I think it should just be two separate commands with no payloads and no if blocks.

The next obvious choice would be to use a payload list in place of the second phrase as nime5ter suggests.

Using last spoken is possible but I don't think it is appropriate for something like this.  I would only consider using that in a tricky situation, which this is not.

carlh1

  • Jr. Member
  • **
  • Posts: 14
  • Karma: 0
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #16 on: November 12, 2015, 10:33:19 PM »
I got it... I still used the same phrase structure but used {lastSpoken} instead of a payload list and {1}. I also had to change the TTS.Speak to TTS.SpeakSync and it worked. thanks SO much!

now I'm going to build it so I can ask for Jazz or Rock or whatever.

Thanks!

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Launching Kodi favorite - addon
« Reply #17 on: November 13, 2015, 08:31:43 AM »
I got it... I still used the same phrase structure but used {lastSpoken} instead of a payload list and {1}. I also had to change the TTS.Speak to TTS.SpeakSync and it worked. thanks SO much!

now I'm going to build it so I can ask for Jazz or Rock or whatever.

This is not a good way to do it and will lead you into trouble in the future.  You should learn how to use payloads.  There is a lot of info in the wiki and the tutorial videos to show you the way.  It is very simple and easy to use once you learn it.

PegLegTV

  • $upporter
  • Sr. Member
  • *****
  • Posts: 497
  • Karma: 43
    • View Profile
Re: Launching Kodi favorite - addon
« Reply #18 on: November 13, 2015, 10:28:11 AM »
I got it... I still used the same phrase structure but used {lastSpoken} instead of a payload list and {1}. I also had to change the TTS.Speak to TTS.SpeakSync and it worked. thanks SO much!

now I'm going to build it so I can ask for Jazz or Rock or whatever.

Thanks!


Jitterjames and Nime5ter are correct the method I posted was sloppy and will cause problems down the road, you should use payload list it will get you less miss fires and more accurate results, I updated the command I shared to work with payloads, sorry for the confusion

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Launching Kodi favorite - addon
« Reply #19 on: November 13, 2015, 11:12:05 AM »
It's good to play around with different ways of doing things so that when you are trying to do something more complex you have the experience, but for this case it really makes much more sense to create two simple commands with no payloads and no logic.  It also allows you better control over how you can phrase each command, since the yes and no responses may required different sentence structure.

The only time I would go out of my way to combine multiple commands into one command is when you are dealing with large payloads.  So for example if you have a "play artist" command and "browse artist" command, it makes sense to combine them so you are not creating two commands that both use a lot of memory to store all the possible artists in your library.

Here's an example of a way to do your yes/no morning jazz routine with two very simple commands.
Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<!--VoxCommando 2.2.1.1-->
<commandGroup open="True" name="Time of day" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="420" name="Yes play some jazz please" 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>
    <phrase>Yes, Yes please</phrase>
    <phrase>play some jazz</phrase>
    <phrase optional="true">please</phrase>
  </command>
  <command id="412" name="No jazz this morning thanks" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <params>
        <param>OK, I hope you have a nice morning!</param>
      </params>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>No jazz this morning</phrase>
    <phrase optional="true">thanks</phrase>
  </command>
</commandGroup>