Kodi Community Forum
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+---- Forum: JSON-RPC (https://forum.kodi.tv/forumdisplay.php?fid=174)
+---- Thread: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC (/showthread.php?tid=68263)



JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2013-09-26

(2013-09-26, 00:07)spambus Wrote: How can you open a tv channel? In some earlier post something was mentioned about Player.Open and channelid with itemHuh

How would an url look like to open a TV channel?

something like this?

http://xbmc:[email protected]:8090/jsonrpc?request={"jsonrpc":"2.0","method":"Player.Open","item":{"channelid":1},"id":1}

but that doesn't work...

Have you checked if there is a channel with ID 1 using the PVR methods of the API?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - spambus - 2013-09-26

Nevermind found it


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - edrikk - 2013-09-27

Hi,

I'm in need of a little help. I'll give background because I know the initial reaction/answer.. Wink

My PC has two video cards, is situated in another room, with in wall HDMI connecting it to a TV. This HDMI is run from the 2nd video card (screen) which only ever 'holds' XBMC. The other video card is connected to a monitor in the room where PC is. It is not uncommon for the TV and PC to be in use at the same time. Keyboard and Mouse controls the "PC Screen" while JSON calls over the network control XBMC.

The JSON calls are made via iPhone apps, as well as some homebrew calls via python, which I make via eventghost (which recieves input from an IR Reciever, which again is connected to that PC via in-wall USB).


So with all that said, I was wondering if a sample json call could be shared with me for the player.seek which would allow me to skip forward / rewind "X" amount of seconds? This would be akin to the "left / right / up / down" arrow keys if they were available to my setup (hence the explanation above Wink ).


Thanks in advance,


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Kabooga - 2013-09-27

This may help
Code:
"{\"jsonrpc\":\"2.0\",\"method\":\"Player.Seek\",\"params\":{\"playerid\":0,\"value\":\"smallforward\"},\"id\":1}"

smallforward, smallbackward, bigforward, bigbackward are accepted values.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - edrikk - 2013-09-27

Awesome! Thank you sir! I don't know what I was doing wrong, but the accepted values weren't working previously (I stopped trying a month ago, so I don't now why).
Again, thanks!


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - yallah - 2013-10-02

Hi,

Why when I change pvr channels with Json I come back to main screen and after change channel? If I change with keypad directly from my keyboard pvr stay on same channel and change directly channel when I validate.

thx


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - learningit - 2013-10-03

Hi,

This may be an incredibly stupid question, but I did try to find an answer by reading through the forum and couldn't quite find the answer.
It appears that a Json equivalent for xbmc.executebuiltin("PlayMedia("filename")") doesn't exist.
Player.Open is close, but it doesn't seem to handle .strm files in the same manner as PlayMedia.

An example where this needs to be done is with the Skin.Widgets service in order to get it to play items which are .strms, such as movies and tv episodes that are added to the library from the Hulu addon.

So, I assume to get the same functionality, I need to first figure out that I have a .strm file, then unpack it, load into a playlist, then do a Player.Open via Json-RPC. Would this be correct or is there an exposed RPC that already does this?

Thanks


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Milhouse - 2013-10-04

What's the best way to remove a movie related artwork item using JSON?

Say I've got the following artwork set for a Movie:
Code:
[
  {
    "movieid": 312,
    "title": "Zombieland",
    "art": {
      "fanart": "image://nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip]-fanart.jpg/",
      "poster": "image://nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip]-poster.jpg/",
      "clearart": "image://http://assets.fanart.tv/fanart/movies/19908/movieart/zombieland-4fd8c70fd673c.png/",
      "clearlogo": "image://http://assets.fanart.tv/fanart/movies/19908/hdmovielogo/zombieland-5145e97ed73a4.png/"
    },
    "file": "nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip].mkv",
    "label": "Zombieland"
  }
]

and now I want to remove just the "clearlogo" item (for example, the url it refers to is no longer valid). How do I do it?

I've tried using VideoLibrary.SetMovieDetails specifying art{ "clearlogo": None} and also art{ "clearlogo": ""} as follows:
Code:
{
  "params": {
    "art": {
      "clearlogo": ""
    },
    "movieid": 312
  },
  "method": "VideoLibrary.SetMovieDetails"
}

but both "" and None/null return the following error:

Code:
{u'jsonrpc': u'2.0', u'id': u'libSetDetails', u'error': {u'message': u'Invalid params.', u'code': -32602, u'data': {u'method': u'VideoLibrary.SetMovieDetails', u'stack': {u'message': u'Received value does not match any of the union type definitions', u'type': [u'null', u'object'], u'name': u'art'}}}}

So unless there's another method I've overlooked, it seems that while you can add new artwork items easily enough, it's impossible to remove artwork items once added...

(Testing with latest Gotham master, JSON v6.6.2)


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Martijn - 2013-10-04

this should be possible. will try at home later


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Milhouse - 2013-10-04

(2013-10-04, 08:54)Martijn Wrote: this should be possible. will try at home later

Cheers, much appreciated.


AW: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2013-10-04

You have to pass in the whole art object but completely leave out whatever you don't want anymore. That will re-write all the art items of that movie and should drop any that aren't specified.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Milhouse - 2013-10-04

(2013-10-04, 10:13)Montellese Wrote: You have to pass in the whole art object but completely leave out whatever you don't want anymore. That will re-write all the art items of that movie and should drop any that aren't specified.


Hmmm... that doesn't seem to be the case.

If I start with:

Code:
[
  {
    "movieid": 312,
    "title": "Zombieland",
    "art": {
      "fanart": "image://nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip]-fanart.jpg/",
      "poster": "image://nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip]-poster.jpg/",
      "clearart": "image://http://assets.fanart.tv/fanart/movies/19908/movieart/zombieland-4fd8c70fd673c.png/",
      "clearlogo": "image://http://assets.fanart.tv/fanart/movies/19908/hdmovielogo/zombieland-5145e97ed73a4.png/"
    },
    "file": "nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip].mkv",
    "label": "Zombieland"
  }

then call "VideoLibrary.SetMovieDetails" with the following request:
Code:
{
  "jsonrpc": "2.0",
  "params": {
    "art": {
      "clearart": "http://test1.png",
      "clearlogo": "http://test2.png"
    },
    "movieid": 312
  },
  "method": "VideoLibrary.SetMovieDetails"
}

I then have in the media library:

Code:
[
  {
    "movieid": 312,
    "title": "Zombieland",
    "art": {
      "fanart": "image://nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip]-fanart.jpg/",
      "poster": "image://nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip]-poster.jpg/",
      "clearart": "image://http://test2.png/",
      "clearlogo": "image://http://test1.png/"
    },
    "file": "nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip].mkv",
    "label": "Zombieland"
  }
]

and NOT the following (which is what you are saying should happen, and what I was expecting):

Code:
[
  {
    "movieid": 312,
    "title": "Zombieland",
    "art": {
      "clearart": "image://http://test2.png/",
      "clearlogo": "image://http://test1.png/"
    },
    "file": "nfs://192.168.0.3/mnt/share/media/Video/MoviesHD/Zombieland (2009)[BDRip].mkv",
    "label": "Zombieland"
  }
]

I'm using MySQL if that makes a difference.

What would be nice is how it appears to be working now, but items set to null/None would be dropped, so I could drop just the clearlogo artwork item by specifying it's value as null/None, and without having to specify (or know) about the other artwork items, which would all be retained.

However if it can be made to work the way you say it should be working, then I can probably work something out on my end... like reading all the details first etc. (eugh!) Smile


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Martijn - 2013-10-04

iirc item set to
Quote:"clearart": None,
are ignored to updated at least that's how i use my private script.
so i'd say

Quote:"clearart": "",
should clear/remove that entry but it's been a long time time since i've seen the actual code

leaving out the ones you don't need and it removes them is not really wanted as that would at least break artwork downloader as it only updates the ones it needs


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Milhouse - 2013-10-04

Specifying the following values
Code:
"clearart": ""
"clearart": None
"clearart": null

all return the following error:

Code:
{u'jsonrpc': u'2.0', u'id': u'libSetDetails', u'error': {u'message': u'Invalid params.', u'code': -32602, u'data': {u'method': u'VideoLibrary.SetMovieDetails', u'stack': {u'message': u'Received value does not match any of the union type definitions', u'type': [u'null', u'object'], u'name': u'art'}}}}



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Martijn - 2013-10-04

doing null for regular information worked (at least long time ago) as i used it in this way
https://github.com/XBMC-Addons/script.library.info.update/blob/master/default.py#L73
it set everything to null and only updated the changed values compared to the library and passed the entire request using JSON which ignored to update the ones with null