Author Topic: VC read alternates aloud  (Read 3336 times)

0 Members and 1 Guest are viewing this topic.

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
VC read alternates aloud
« on: October 15, 2013, 09:03:48 AM »
Hi to all, I post here a command group that read the alternates (which VC has created) aloud.

important: you must set the check mark Generate VC.Alternates event in VoxCommando "Options Menu" - General tab

This posted command group use the payload "xbmcArtist.xml" which is for XBMC, but you can use any other payload (e.g. xbmcSongs.xml, iTunesArtist.xml and so on), but don't forget to change the phrase if you use other things like songs, album ...
and also the (A)Contains(B) in the logic block (play music). I use a logic block in this command to execute it only when the phrase contains the words "play" or "music". Otherwise VC read alternates from any command aloud.
Thanks to James, he figured out this easy way  ::bow

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="False" name="play music or artist (read alternates aloud)" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="417" name="play music by {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>OSD.ShowText</cmdType>
      <cmdString>{PF.1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>play</phrase>
    <phrase>artist, music by</phrase>
    <payloadFromXML phraseOnly="True" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">XbmcPayloads\xbmcArtists.xml</payloadFromXML>
  </command>
  <command id="1163" name="alternates event" enabled="true" alwaysOn="False" 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 music</ifParams>
      <then>
        <action>
          <cmdType>Results.SetLastResult</cmdType>
          <cmdString>There are {#P} alternates available. You can choose from option 1, to option {#P}.</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.SetLastResult</cmdType>
          <cmdString>{LastResult}{CR}Option {i}: {{i}}.</cmdString>
          <cmdRepeat>{#P}</cmdRepeat>
        </action>
        <action>
          <cmdType>Results.RegExReplace</cmdType>
          <cmdString>play.*?\{|}</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>OSD.ShowText</cmdType>
          <cmdString>{LastResult}</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <cmdString>{LastResult}</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </then>
      <else />
    </if>
    <event>VC.Alternates.*</event>
  </command>
</commandGroup>
« Last Edit: October 15, 2013, 09:53:56 AM by Kalle »
***********  get excited and make things  **********

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: VC read alternates aloud
« Reply #1 on: October 15, 2013, 09:13:20 AM »
You can modify in this group the command "alternates event" which allow you how many alternates  VC are read (sometimes it is annoying when VC read 10 alternates).

this command read the first 3 alternates (replace the alternates event with this command)
or
to change the number of alternates by your self - replace the repeat "3" with any other number which make sense.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<command id="1163" name="alternates event (read the first 3 alternates)" enabled="true" alwaysOn="False" 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 music</ifParams>
    <then>
      <action>
        <cmdType>Results.SetLastResult</cmdType>
        <cmdString>There are {#P} alternates available. You can choose from option 1, to option {#P}. Here the first 3 alternates.</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.SetLastResult</cmdType>
        <cmdString>{LastResult}{CR}Option {i}: {{i}}.</cmdString>
        <cmdRepeat>3</cmdRepeat>
      </action>
      <action>
        <cmdType>Results.RegExReplace</cmdType>
        <cmdString>play.*?\{|}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>OSD.ShowText</cmdType>
        <cmdString>{LastResult}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
      <action>
        <cmdType>TTS.SpeakSync</cmdType>
        <cmdString>{LastResult}</cmdString>
        <cmdRepeat>1</cmdRepeat>
      </action>
    </then>
    <else />
  </if>
  <event>VC.Alternates.*</event>
</command>
« Last Edit: October 15, 2013, 09:32:39 AM by Kalle »
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: VC read alternates aloud
« Reply #2 on: October 15, 2013, 10:09:17 AM »
Is this the same code block twice now, or is one different?

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: VC read alternates aloud
« Reply #3 on: October 15, 2013, 10:15:24 AM »
the first code in this threat is a command group and the second code is only a command from the group but with changes.
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: VC read alternates aloud
« Reply #4 on: October 15, 2013, 12:57:36 PM »
OK, THANKS!