Author Topic: Set song rating  (Read 1917 times)

0 Members and 1 Guest are viewing this topic.

miniburk

  • Jr. Member
  • **
  • Posts: 4
  • Karma: 0
    • View Profile
Set song rating
« on: October 06, 2013, 10:53:06 AM »
Thanx for a great program!  Love it ! =)

Then the question, how do I set rating in xbmc thru voxcommando ?   I did it by accident, and it's a really good thing to know !

Regards; PB

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: about stars
« Reply #1 on: October 06, 2013, 02:29:58 PM »
Hi miniburk.

Do you mean, to set rating for the currently playing song?

What do you mean you did it by accident?


miniburk

  • Jr. Member
  • **
  • Posts: 4
  • Karma: 0
    • View Profile
Re: about stars
« Reply #2 on: October 06, 2013, 05:44:48 PM »
Hi !
Yes, I said something wrong (can't remember what) and it set 5 stars on the song that was playing at the moment =)    Tried to find a command for this on the internet, but I didn't find anything

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7713
  • Karma: 116
    • View Profile
    • VoxCommando
Re: about stars
« Reply #3 on: October 06, 2013, 05:46:23 PM »
I don't believe there is a command for that if you are using the standard configuration for Frodo, but...

Here are three commands for modifying the rating of a song in XBMC.

- "Increase rating"
- "Decrease rating"
- "Set rating X"  (where X is 1-5)

The first two work fine.

The XBMC json api seems to be a bit buggy when using  AudioLibrary.SetSongDetails.  If you use "Set rating X", it will not really update the rating properly until you stop playing the current song.  If you use "set rating x" and then use "increase rating" it will increase the rating based on what it was before you set the rating!  If you use "Set rating X" and then ask for the rating it will give you the old value, unless you stop and then restart the song.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="XBMC adjust ratings" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="503" name="Increase rating" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Input.ExecuteAction&amp;&amp;"action":"increaserating"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SoftMute</cmdType>
      <cmdString>60</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Pause</cmdType>
      <cmdString>100</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GetItem&amp;&amp;"playerid":0, "properties": ["rating"]</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>XJson.ParseTokens</cmdType>
          <cmdString>rating set to: {item.rating} stars</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>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <cmdString>I am not able to set the rating right now</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>XJson.SoftUnMute</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Increase rating</phrase>
  </command>
  <command id="484" name="Decrease rating" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Input.ExecuteAction&amp;&amp;"action":"decreaserating"</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SoftMute</cmdType>
      <cmdString>60</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>VC.Pause</cmdType>
      <cmdString>100</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GetItem&amp;&amp;"playerid":0, "properties": ["rating"]</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <if ifBlockDisabled="False" ifNot="False">
      <ifType>LastActionSuccess</ifType>
      <ifParams>&amp;&amp;</ifParams>
      <then>
        <action>
          <cmdType>XJson.ParseTokens</cmdType>
          <cmdString>rating set to: {item.rating} stars</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>
        <action>
          <cmdType>TTS.SpeakSync</cmdType>
          <cmdString>I am not able to set the rating right now</cmdString>
          <cmdRepeat>1</cmdRepeat>
        </action>
      </else>
    </if>
    <action>
      <cmdType>XJson.SoftUnMute</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>Decrease rating</phrase>
  </command>
  <command id="522" name="set rating" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.SoftMute</cmdType>
      <cmdString>60</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.GetItem&amp;&amp;"playerid":0, "properties": ["rating"]</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.ParseTokens</cmdType>
      <cmdString>{item.id}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>AudioLibrary.SetSongDetails&amp;&amp;"songid": {LastResult}, "rating": {1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>TTS.SpeakSync</cmdType>
      <cmdString>Rating should now be {1}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <action>
      <cmdType>XJson.SoftUnMute</cmdType>
      <cmdString />
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>set rating</phrase>
    <phrase optional="true">to</phrase>
    <payloadRange>1,5</payloadRange>
    <phrase optional="true">stars</phrase>
  </command>
</commandGroup>
« Last Edit: October 06, 2013, 05:48:37 PM by jitterjames »

miniburk

  • Jr. Member
  • **
  • Posts: 4
  • Karma: 0
    • View Profile
Re: about stars
« Reply #4 on: October 07, 2013, 12:14:29 PM »
Very helpful ! Thnx ! =)

PB