JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC

  Thread Rating:
  • 8 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Montellese Offline
Team-XBMC Developer
Posts: 3,769
Joined: Jan 2009
Reputation: 36
Location: Switzerland
Post: #2656
(2013-01-05 12:12)kevinkelm Wrote:  That's great thanks. Would this work for toggling subtitles on and off?

{"jsonrpc": "2.0", "method": "Player.SetSubtitle", "params": { "subtitle": "toggle" }, "id": "1"}

Currently for SetSubtitle only the values "previous", "next", "off" and "on" or a specific subtitle index (0 to x) are supported. Subtitles are more of a cycle and not a toggle thing. But I guess in the future it would make sense to either add a "cycle" value which goes from "off" to 0 to 1 to ... to "off" or add a "toggle" value which just toggles between "off" and "on".

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
wuench Offline
Member
Posts: 58
Joined: Dec 2010
Reputation: 0
Post: #2657
(2013-01-05 09:35)Montellese Wrote:  What's the filename of your ISO? Is it really *.ISO" or is it "*.iso"? Because if the filename you pass in through "file" to Player.Open doesn't match the real filename 100% XBMC won't be able to find the file in the database and therefore won't be able to assign any metadata to it. In the GUI this can't happen because the item you play comes from the database with all the proper information.

Ah, you are a wise man. I had changed the extension on that particular file to lower case to test the previous bug and never updated MyMovies which is the source of the file name I am passing using Player.Open. So basically the file extension I was passing had the wrong case, and did not match. Thank you.

BTW, the reason for this whole caps extension thing is MyMovies. When it creates an ISO it uses a caps extension for the file name.
(This post was last modified: 2013-01-05 19:50 by wuench.)
find quote
kevinkelm Offline
Member
Posts: 53
Joined: Jan 2013
Reputation: 0
Post: #2658
(2013-01-05 12:18)Montellese Wrote:  
(2013-01-05 12:12)kevinkelm Wrote:  That's great thanks. Would this work for toggling subtitles on and off?

{"jsonrpc": "2.0", "method": "Player.SetSubtitle", "params": { "subtitle": "toggle" }, "id": "1"}

Currently for SetSubtitle only the values "previous", "next", "off" and "on" or a specific subtitle index (0 to x) are supported. Subtitles are more of a cycle and not a toggle thing. But I guess in the future it would make sense to either add a "cycle" value which goes from "off" to 0 to 1 to ... to "off" or add a "toggle" value which just toggles between "off" and "on".

Thanks guys, just one more question. Is there a command to set watched status? I don't see one in the docs.
Thanks!
find quote
N3MIS15 Offline
Donor
Posts: 504
Joined: Jul 2010
Reputation: 13
Location: Melbourne, VIC
Post: #2659
VideLibrary.SetMovieDetails
{"id":0,"jsonrpc":"2.0","method":"VideoLibrary.SetMovieDetails","params":{"movieid":1,"playcount":1}} (untested)

[Image: all-fanart.jpg]
find quote
johnsills1 Offline
Senior Member
Posts: 150
Joined: Jan 2011
Reputation: 0
Post: #2660
Is there somewhere that I can learn this JSON jargon... I'm trying to create a command to go to Movies, Music, and TV Shows from anywhere in XBMC.... For instance, if I'm on the setup screen, I want to be able to immediately goto the Movies screen with a command.....Any help would be appreciated as well as a detailed description JSON and how it works. I know that my be asking alot, but I am having a lot of trouble figuring it out on my own.
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,769
Joined: Jan 2009
Reputation: 36
Location: Switzerland
Post: #2661
Most links to JSON-RPC related pages are available on the wiki page.

For your specific question you want to look at the GUI.ActivateWindow command and for a list of existing windows take a look at Window IDs and Opening Windows and Dialogs.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Millencolin007 Offline
Fan
Posts: 397
Joined: Mar 2012
Reputation: 9
Location: Switzerland
Post: #2662
Hi,

When adding items from an addon to the "now playing" playlist over json-rpc, the thumbnail often doesn't get added and the label is calculated from the stream url (and is often empty) . This is probably because the file is not in the library and is added using Playlist.Add (with "file" parameter) and xbmc cannot resolve the label and thumbnail from the http url, which is understandable. xbmc probably passes the thumbnail and label to the playqueue when it is played from the plugin directly.

Would it be possible to add a thumbnail and label parameters (or maybe even more metadata) to Playlist.Add when using the "file" option to queue an item to bypass this problem?

Example where you can see the problem: Adding a stream from the addon "digitally imported" to the playqueue using xbmc shows the thumbnail and proper label, adding the same using json-rpc shows a part of the http url and no thumbnail.

Should I open a feature request for this?
find quote
Ayla Offline
Fan
Posts: 607
Joined: Feb 2008
Reputation: 0
Post: #2663
Can I use JSON-RPC with keymaps?

If yes, which keymap file should I use (is it keyboard.xml)?

For example when I send the Input.Action "left" command, I would like it to do something different when playing back fullscreen video.
find quote
N3MIS15 Offline
Donor
Posts: 504
Joined: Jul 2010
Reputation: 13
Location: Melbourne, VIC
Post: #2664
(2013-01-06 23:21)Ayla Wrote:  Can I use JSON-RPC with keymaps?

If yes, which keymap file should I use (is it keyboard.xml)?

For example when I send the Input.Action "left" command, I would like it to do something different when playing back fullscreen video.

Nope, the Event Server is best for keymaps. There are some examples is the XBMC srource: https://github.com/xbmc/xbmc/tree/master...s/examples

[Image: all-fanart.jpg]
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,769
Joined: Jan 2009
Reputation: 36
Location: Switzerland
Post: #2665
(2013-01-06 23:05)Millencolin007 Wrote:  Hi,

When adding items from an addon to the "now playing" playlist over json-rpc, the thumbnail often doesn't get added and the label is calculated from the stream url (and is often empty) . This is probably because the file is not in the library and is added using Playlist.Add (with "file" parameter) and xbmc cannot resolve the label and thumbnail from the http url, which is understandable. xbmc probably passes the thumbnail and label to the playqueue when it is played from the plugin directly.

Would it be possible to add a thumbnail and label parameters (or maybe even more metadata) to Playlist.Add when using the "file" option to queue an item to bypass this problem?

Example where you can see the problem: Adding a stream from the addon "digitally imported" to the playqueue using xbmc shows the thumbnail and proper label, adding the same using json-rpc shows a part of the http url and no thumbnail.

Should I open a feature request for this?
This is more of a problem on how or rather when XBMC retrieves the details for an item. When you view it in the GUI, it gets the details directly from the plugin and has it available when you queue it. Through JSON-RPC there's only the filename/stream URL and it doesn't look up the information. IMO there should be some logic to retrieve those details before adding the item to the playlist but I'm not sure if that's even possible with plugins right now (i.e. retrieving details for a single item).

(2013-01-06 23:21)Ayla Wrote:  Can I use JSON-RPC with keymaps?

If yes, which keymap file should I use (is it keyboard.xml)?

For example when I send the Input.Action "left" command, I would like it to do something different when playing back fullscreen video.
I'm not sure I follow. JSON-RPC's Input.* methods do not care about keymaps as they already execute actions (and not keypresses). So when you send Input.Action "left" it will do whatever happens for the "left" action and not for the "left" key.

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Ayla Offline
Fan
Posts: 607
Joined: Feb 2008
Reputation: 0
Post: #2666
(2013-01-06 23:57)Montellese Wrote:  
(2013-01-06 23:21)Ayla Wrote:  Can I use JSON-RPC with keymaps?

If yes, which keymap file should I use (is it keyboard.xml)?

For example when I send the Input.Action "left" command, I would like it to do something different when playing back fullscreen video.
I'm not sure I follow. JSON-RPC's Input.* methods do not care about keymaps as they already execute actions (and not keypresses). So when you send Input.Action "left" it will do whatever happens for the "left" action and not for the "left" key.

Can I achieve what I want by sending keypresses for all my commands instead of Input.Action etc., and still use JSON-RPC?

For example, send key "a" to go left (under global in keyboard.xml) and use "a" to rewind (under fullscreenvideo in keyboard.xml)

If so, could you post the command line I need to use to send keypress "a" with JSON?

Thanks again
find quote
johnsills1 Offline
Senior Member
Posts: 150
Joined: Jan 2011
Reputation: 0
Post: #2667
(2013-01-06 13:07)Montellese Wrote:  Most links to JSON-RPC related pages are available on the wiki page.

For your specific question you want to look at the GUI.ActivateWindow command and for a list of existing windows take a look at Window IDs and Opening Windows and Dialogs.

Thanks for the info, but I am stilled confused about JSON RPC. Those pages gave me no insight on how to write the JSON command

Also, doesn't the bit about Opening Windows and Dialogs where it talks about the Built In Function only exist for HTTP control and not JSON?
(This post was last modified: 2013-01-07 06:13 by johnsills1.)
find quote
kevinkelm Offline
Member
Posts: 53
Joined: Jan 2013
Reputation: 0
Post: #2668
(2013-01-06 07:27)N3MIS15 Wrote:  VideLibrary.SetMovieDetails
{"id":0,"jsonrpc":"2.0","method":"VideoLibrary.SetMovieDetails","params":{"movieid":1,"playcount":1}} (untested)

I'm getting this error using this code

22:35:16 T:4629241856 DEBUG: JSONRPC: Incoming request: {"id":0,"jsonrpc":"2.0","method":"VideoLibrary.SetMovieDetails","params":{"movieid":1,"playcount":1}}
22:35:16 T:4629241856 DEBUG: JSONRPC: Calling videolibrary.setmoviedetails
22:35:16 T:4629241856 DEBUG: JSONRPC: Type mismatch in type
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,769
Joined: Jan 2009
Reputation: 36
Location: Switzerland
Post: #2669
(2013-01-07 11:49)kevinkelm Wrote:  
(2013-01-06 07:27)N3MIS15 Wrote:  VideLibrary.SetMovieDetails
{"id":0,"jsonrpc":"2.0","method":"VideoLibrary.SetMovieDetails","params":{"movieid":1,"playcount":1}} (untested)

I'm getting this error using this code

22:35:16 T:4629241856 DEBUG: JSONRPC: Incoming request: {"id":0,"jsonrpc":"2.0","method":"VideoLibrary.SetMovieDetails","params":{"movieid":1,"playcount":1}}
22:35:16 T:4629241856 DEBUG: JSONRPC: Calling videolibrary.setmoviedetails
22:35:16 T:4629241856 DEBUG: JSONRPC: Type mismatch in type

It's not an error, it's a debug message that might help you find a problem with your request if the response is an error. As long as you don't get a JSON-RPC error response, there's no need to look into the log for these log messages Wink

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

[Image: badge.gif]
find quote
Ayla Offline
Fan
Posts: 607
Joined: Feb 2008
Reputation: 0
Post: #2670
(2013-01-07 00:51)Ayla Wrote:  
(2013-01-06 23:57)Montellese Wrote:  
(2013-01-06 23:21)Ayla Wrote:  Can I use JSON-RPC with keymaps?

If yes, which keymap file should I use (is it keyboard.xml)?

For example when I send the Input.Action "left" command, I would like it to do something different when playing back fullscreen video.
I'm not sure I follow. JSON-RPC's Input.* methods do not care about keymaps as they already execute actions (and not keypresses). So when you send Input.Action "left" it will do whatever happens for the "left" action and not for the "left" key.

Can I achieve what I want by sending keypresses for all my commands instead of Input.Action etc., and still use JSON-RPC?

For example, send key "a" to go left (under global in keyboard.xml) and use "a" to rewind (under fullscreenvideo in keyboard.xml)

If so, could you post the command line I need to use to send keypress "a" with JSON?

Thanks again

Montellese; Should I use Input.SendText for this or will it only work for navigation (I see Permissions: Navigation listed)?
find quote
Post Reply