Support for XBMC2 plugin (formerly XBMCRepeat)

Questions and comments specific to a particular plugin should go here.
jonib
Plugin Developer
Posts: 1282
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib » Sat Feb 15, 2014 12:07 am

Ace5342 wrote:I have installed the latest version from the link in this thread (on page 55 I think). Most of the time I get a -32602 error.
You need to show me the log as an error number is useless for me. And show what you are trying to do.
I see the input box and have tried to put in JSON RPC in there like but I get a -32601 error Method not found.
What version of XBMC are you using? and I need to know what method/parameters you are trying.
what I would like to do with your plugin for example is get the name of the current artist and then use that result to make further requests like GetSong by this artist and then play them.
I'll show you an example later, I might not have time today.
This looks like it will be possible with your plugin as the methods are all there I just don't know how to use it.
I am planning to make using the JSON-RPC actions easier but I need to finish some stuff first. Unfortunately my motivation to work on the plugin has been very low for a while.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

Ace5342
Posts: 4
Joined: Thu Feb 13, 2014 6:26 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by Ace5342 » Sat Feb 15, 2014 12:58 am

I am running XBMC 12.2 on Raspbmc

When I try AudioLibrary.GetArtistDetails (with audio playing)

Code: Select all

  
XBMC2: JSONRPC: AudioLibrary.GetArtistDetails
Error:
    {
     "code": -32602, 
     "data": {
       "method": "AudioLibrary.GetArtistDetails", 
       "stack": {
         "message": "Missing parameter", 
         "name": "artistid", 
         "type": "integer"
       }
     }, 
     "message": "Invalid params."
   }
and if I try AudioLibrary.GetArtistDetails (with audio playing) I don't get anything in my results.

Code: Select all

XBMC2: JSONRPC: AudioLibrary.GetArtists 
   Result:
   {
     "limits": {
       "end": 0, 
       "start": 0, 
       "total": 0
     }
   }


using the input box for a notification if I put in JSON

eg. {"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Title Message","message":"Main message"}}

Code: Select all

XBMC2: JSONRPC: GUI.ShowNotification
   Error:
    {
     "code": -32602, 
     "data": {
       "method": "GUI.ShowNotification", 
       "stack": {
         "message": "Missing parameter", 
         "name": "title", 
         "type": "string"
       }
     }, 
     "message": "Invalid params."
   }
I have tried various different formats for the JSON and if I put in plain text

eg. "Hello" I get

Code: Select all

XBMC2: JSONRPC: GUI.ShowNotification
   Error in Action: "XBMC2: JSONRPC: GUI.ShowNotification"
   Traceback (most recent call last) (1640):
     File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
       return self(*args)
     File "C:\Program Files (x86)\EventGhost\plugins\XBMCRepeat\__init__.py", line 920, in __call__
       responce = self.plugin.JSON_RPC.send(method, ast.literal_eval(ParseString2(param)))
     File "ast.pyc", line 68, in literal_eval
     File "ast.pyc", line 67, in _convert
   ValueError: malformed string

Thank you for taking the time an example would be very helpful.

James

jonib
Plugin Developer
Posts: 1282
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib » Sat Feb 15, 2014 1:48 am

Ace5342 wrote:what I would like to do with your plugin for example is get the name of the current artist and then use that result to make further requests like GetSong by this artist and then play them.
An example to get the artist from the currently playing song:

Code: Select all

JSON-RPC->Player->GetActivePlayers->(No parameters)
This gets the playerid that is needed for the other actions.
XBMC2GetSong1.png

Code: Select all

JSON-RPC->Player->GetItem->{"playerid":{{eg.result[0]["playerid"]}},"properties":["artist","title"]}
This uses {{eg.result[0]["playerid"]}} to get the playerid from the previous action. This ["artist","title"] is a list of properties you want returned, look here for a completet list (press show).
XBMC2GetSong2.png

Code: Select all

{eg.result["item"]["artist"][0]}
This is an example to show the artist in ShowOSD.
XBMC2GetSong3.png
Hopefully you find this helpful, ask again if you want help.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

jonib
Plugin Developer
Posts: 1282
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib » Sat Feb 15, 2014 2:12 am

Ace5342 wrote:When I try AudioLibrary.GetArtistDetails (with audio playing)

Code: Select all

  
XBMC2: JSONRPC: AudioLibrary.GetArtistDetails
Error:
    {
     "code": -32602, 
     "data": {
       "method": "AudioLibrary.GetArtistDetails", 
       "stack": {
         "message": "Missing parameter", 
         "name": "artistid", 
         "type": "integer"
       }
     }, 
     "message": "Invalid params."
   }
This is much more helpful. AudioLibrary commands don't care if anything is playing. You need to provide artistid and a list of properties you want returned. Here is list of properties.

Code: Select all

{"artistid": 123,"properties":["genre","yearsactive"]}
example not tested.
and if I try AudioLibrary.GetArtistDetails (with audio playing) I don't get anything in my results.
The same parameters as the previous action.
using the input box for a notification if I put in JSON

eg. {"id":1,"jsonrpc":"2.0","method":"GUI.ShowNotification","params":{"title":"Title Message","message":"Main message"}}
You only need the "params" part so

Code: Select all

{"title":"Title Message","message":"Main message"}
Should work. I am planning to make it work by pasting the complete JSON-RPC request and extract the information, but I have not implemented it yet.
I have tried various different formats for the JSON and if I put in plain text
All the parameters need either to be surrounded with "[]" (square brackets) or "{}" (Curly braces). so for example the Application.SetVolume only needs a number you need to put it like this

Code: Select all

[100]
Or

Code: Select all

{"volume":100}
To put the volume at 100%

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

Ace5342
Posts: 4
Joined: Thu Feb 13, 2014 6:26 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by Ace5342 » Sat Feb 15, 2014 11:46 am

Thank you Jonib

This it has been a massive help I have just given it a quick try and it all works I will now go and have a play with it.

James.

wilkins502
Posts: 1
Joined: Sat Feb 22, 2014 9:32 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by wilkins502 » Sat Feb 22, 2014 9:40 pm

Hello All,

First off, thank you for an amazing program. I Had trouble editing the XML file manually on my Ortek remote, so i found my way to this program and this plugin specifically.

I have every feature working using this plugin except for one that I personally am looking for. I'm looking to have the subtitle function from the XBMC opensubtitle's addon run when i press RecordedTV on my remote.

According to the Wiki this script should make that happen-- RunScript(script.xbmc.subtitles) -- I can't figure out how to add this into eventghost. Is this possible? Do i need to write my own plugin and then reference that?

What i wanted to do is just edit one of the existing buttons that the XBMC2 plugin has that I don't use (next subtitle, increase subtitledelay) and modify it to run the script to open the subtitle menu instead. I couldn't figure out how to edit it, it just seems to be the same thing repeating itself in the .PY file so i'm at a loss.

Thanks in Advance, any help is much appreciated.
Wilkins

jonib
Plugin Developer
Posts: 1282
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib » Sun Feb 23, 2014 6:31 am

wilkins502 wrote:First off, thank you for an amazing program. I Had trouble editing the XML file manually on my Ortek remote, so i found my way to this program and this plugin specifically.
Glad to hear it.
According to the Wiki this script should make that happen-- RunScript(script.xbmc.subtitles) -- I can't figure out how to add this into eventghost. Is this possible?
Looks like I answered a similar question before here two pages back in this thread. Unfortunately I did not get a response back so I don't know if it worked for him.

It's always good to read a couple of pages back, before posting a question as there might be an answer already. Just a general tip.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

steve1977
Posts: 17
Joined: Sun Dec 01, 2013 8:50 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by steve1977 » Sun Feb 23, 2014 8:31 am

jonib wrote:
steve1977 wrote: 1) Plus and minus work, but there are two things missing:
* plus (long) and minus (long). Not an issue as I could do this myself
What did you have to do?
Here we go with what I did to get this running. I added from the "old" (stable) version of your plugin the following key:

+ (long)
key
XBMC2: Up

- (long)
key
XBMC2: Down


If you have any other idea on the audio control, this would be appreciated. I will look into the keymap separately today. Thanks!

jonib
Plugin Developer
Posts: 1282
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib » Sun Feb 23, 2014 8:55 am

steve1977 wrote: Here we go with what I did to get this running. I added from the "old" (stable) version of your plugin the following key:

+ (long)
key
XBMC2: Up

- (long)
key
XBMC2: Down
Hmm, I don't understand. How/what did you add from the "old" (stable) version? I don't remember removing anything so how could you add in something from the old version.
If you have any other idea on the audio control, this would be appreciated. I will look into the keymap separately today. Thanks!
I did some tests before. But I couldn't figure out whats happening. Sometimes I get errors in the XBMC debug log about unrecognized AppleRemote codes. But all the buttons seem to work fine except when in fullscreen video mode. I will have to do same more testing and after I probably need to ask in the XBMC forum.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

steve1977
Posts: 17
Joined: Sun Dec 01, 2013 8:50 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by steve1977 » Sun Feb 23, 2014 11:30 am

jonib wrote:
steve1977 wrote: Here we go with what I did to get this running. I added from the "old" (stable) version of your plugin the following key:

+ (long)
key
XBMC2: Up

- (long)
key
XBMC2: Down
Hmm, I don't understand. How/what did you add from the "old" (stable) version? I don't remember removing anything so how could you add in something from the old version.
You are right. Actually, I had already added those in the "old" version myself (I forgot!). Basically, "up" is now called "+". Given you added left (long), you may also want to add + (long) per default.

jonib
Plugin Developer
Posts: 1282
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib » Wed Feb 26, 2014 5:17 am

steve1977 wrote:You are right. Actually, I had already added those in the "old" version myself (I forgot!). Basically, "up" is now called "+". Given you added left (long), you may also want to add + (long) per default.
OK, now I understand. I don't think it's logical to add buttons that isn't defined in the "joystick.AppleRemote.xml" keymap in XBMC. I'll gladly add any buttons if they are added in the keymap later.
It's fairly easy for a user to add the functionality like you did.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

sidynele
Posts: 2
Joined: Wed Feb 26, 2014 10:04 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by sidynele » Wed Feb 26, 2014 10:32 pm

@jonib

I thoroughly appreciate your XBMC2 plugin, you've helped make my HTPC incredible! I am just running into one snag, I am having difficulties triggering the ExecuteAddon json command. I would like to be able to open the Pandora XBMC addon with a button press on my Logitech Harmony One remote. I am on ver 0.6.9

I have tried entering the following in as a parameter with no luck. (originally found here) - https://getsatisfaction.com/irule/topic ... with_irule

Code: Select all

 {"jsonrpc": "2.0", "method": "Addons.ExecuteAddon", "params": { "addonid": "script.xbmc.pandorajson"}, "id": 1 } 

jonib
Plugin Developer
Posts: 1282
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib » Thu Feb 27, 2014 3:04 pm

sidynele wrote:I thoroughly appreciate your XBMC2 plugin, you've helped make my HTPC incredible!
Thanks.
I have tried entering the following in as a parameter with no luck. (originally found here) - https://getsatisfaction.com/irule/topic ... with_irule

Code: Select all

 {"jsonrpc": "2.0", "method": "Addons.ExecuteAddon", "params": { "addonid": "script.xbmc.pandorajson"}, "id": 1 } 
You should be able to do what I posted here. Just change

Code: Select all

['script.xbmc.subtitles']
to

Code: Select all

['script.xbmc.pandorajson']
I'll try to make it possible to just paste the complete JSON-RPC command and make it extract the parameters, the next time I work on the plugin.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image

jonib
Plugin Developer
Posts: 1282
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib » Thu Feb 27, 2014 5:12 pm

I'm posting a new test version 0.6.14 of the XBMC2 plugin.

Only change is that it should be possible to paste a complete JSON-RPC command (example below) in the parameter field.

Code: Select all

{"jsonrpc": "2.0", "method": "Addons.ExecuteAddon", "params": { "addonid": "script.audio.pandora"}, "id": 1 } 
And the plugin will (hopefully) extract the relevant information.

This was an unscheduled coding effort, so I haven't done too much testing, so please report any problems.

jonib
Attachments
__init__.py
Test version 0.6.14 of the XBMC2 plugin.
(104.91 KiB) Downloaded 309 times
XBMC2 plugin to control XBMC. If you want to flatter me Image

sidynele
Posts: 2
Joined: Wed Feb 26, 2014 10:04 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by sidynele » Thu Feb 27, 2014 5:42 pm

I'm posting a new test version 0.6.14 of the XBMC2 plugin.
Awesome, thanks a lot @jonib

I was able to get it working with your previous suggestion, although I had a user error for the proper script name (copy/paste fail).

The correct parameter to open the XBMC Pandora addon is as follows:

Code: Select all

['script.audio.pandora']

Post Reply