So I had a request last night from the wife to have the ability to rate songs in Pandora from the HSTouch panels for squeezebox. There may be another way of doing this, but this was the only way I figured out how to do it, and figured I would share with others that may be looking for the same thing.
I built this script, and then have 2 events that are triggered by the "buttons" in HSTouch. It also has things in it to control the display on my Russound panels to give feedback that the button was pressed (just in case we want to do it from the Russound Keypad vs HSTouch screen). You can remove this stuff.
This is the main component to do the rating:
hs.PluginFunction("SqueezeBox", playerInstance, "PlayerSendCLICommand", Args)
and here is the data for "Args":
Args(0) = "pandora rate 0" (0 is thumbs down, 1 is thumbs up)
Args(1) = False
I built this script, and then have 2 events that are triggered by the "buttons" in HSTouch. It also has things in it to control the display on my Russound panels to give feedback that the button was pressed (just in case we want to do it from the Russound Keypad vs HSTouch screen). You can remove this stuff.
This is the main component to do the rating:
hs.PluginFunction("SqueezeBox", playerInstance, "PlayerSendCLICommand", Args)
and here is the data for "Args":
Args(0) = "pandora rate 0" (0 is thumbs down, 1 is thumbs up)
Args(1) = False
Code:
Dim playerInstance As String Dim Args(1) As Object Dim Kitchen_Keypad as integer Dim Bathroom_Keypad as integer DIM Title as string Dim Thumbs_Up as string Dim Thumbs_Down as String Sub Down(Parms As Object) Try Kitchen_Keypad = hs.DeviceValue(525) Bathroom_Keypad = hs.DeviceValue(564) Args(0) = "pandora rate 0" Args(1) = False playerInstance = "Player_b827ebb275f9" Title = (hs.DeviceString(622)) Thumbs_Up = "Thumbs Up" Thumbs_Down = "Thumbs Down" If (Kitchen_Keypad = 100) then hs.PluginFunction("SqueezeBox", playerInstance, "PlayerSendCLICommand", Args) hs.PluginFunction("BLRussound", "", "SendMessageZone", {1,2,Thumbs_Down,"Left",0}) hs.waitSecs(2) hs.PluginFunction("BLRussound", "", "SendMessageZone", {1,2,Title,"Left",0}) ElseIf (Bathroom_Keypad = 100) then hs.PluginFunction("SqueezeBox", playerInstance, "PlayerSendCLICommand", Args) hs.PluginFunction("BLRussound", "", "SendMessageZone", {1,5,Thumbs_Down,"Left",0}) hs.waitSecs(2) hs.PluginFunction("BLRussound", "", "SendMessageZone", {1,5,Title,"Left",0}) Else hs.writelog("SqueezeBox Scripts", "All Keypads Off, Do Nothing") End If Catch ex As Exception hs.WriteLog("SqueezeBox Scripts", "Exception " & ex.ToString) End Try End Sub Sub Up(Parms As Object) Try Kitchen_Keypad = hs.DeviceValue(525) Bathroom_Keypad = hs.DeviceValue(564) Args(0) = "pandora rate 1" Args(1) = False playerInstance = "Player_b827ebb275f9" Title = (hs.DeviceString(622)) Thumbs_Up = "Thumbs Up" Thumbs_Down = "Thumbs Down" If (Kitchen_Keypad = 100) then hs.PluginFunction("SqueezeBox", playerInstance, "PlayerSendCLICommand", Args) hs.PluginFunction("BLRussound", "", "SendMessageZone", {1,2,Thumbs_Up,"Left",0}) hs.waitSecs(2) hs.PluginFunction("BLRussound", "", "SendMessageZone", {1,2,Title,"Left",0}) ElseIf (Bathroom_Keypad = 100) then hs.PluginFunction("SqueezeBox", playerInstance, "PlayerSendCLICommand", Args) hs.PluginFunction("BLRussound", "", "SendMessageZone", {1,5,Thumbs_Up,"Left",0}) hs.waitSecs(2) hs.PluginFunction("BLRussound", "", "SendMessageZone", {1,5,Title,"Left",0}) Else hs.writelog("SqueezeBox Scripts", "All Keypads Off, Do Nothing") End If Catch ex As Exception hs.WriteLog("SqueezeBox Scripts", "Exception " & ex.ToString) End Try End Sub
Comment