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)



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-12-06

(2012-12-05, 11:01)N3MIS15 Wrote:
(2012-12-05, 10:39)Montellese Wrote: I have no clue what you are mentioning/talking about. Will need a better problem description.

Request:
Code:
{
    "params": {
        "playerid": 1,
        "properties": [
            "title",
            "season",
            "episode",
            "duration",
            "showtitle",
            "fanart",
            "tvshowid",
            "plot",
            "thumbnail",
            "year"
        ]
    },
    "jsonrpc": "2.0",
    "id": 0,
    "method": "Player.GetItem"
}

Response:
Code:
{
    "jsonrpc": "2.0",
    "id": 0,
    "result": {
        "item": {
            "plot": "",
            "tvshowid": -1,
            "episode": -1,
            "title": "",
            "fanart": "",
            "season": -1,
            "label": "",
            "year": 0,
            "type": "unknown",
            "thumbnail": "",
            "showtitle": ""
        }
    }
}

Player.GetItem won't return any information for video files that are not in the video library. (Player.GetItem is the only method i have tested)

EDIT: i know there is alot of useless params there, the main concerns are label and thumbnail as they should be returned for any video file (especially label).
If the files are opened from GUI they return data just fine.

I just tried this with a few local files (which are not in the library) and "label" always has the file name in it. "thumbnail" can't be filled. That only works when you start the video from the GUI and you navigate into the directory where both the video file and the artwork is. Then xbmc automatically associates the local artwork with the file. Otherwise (e.g. through JSON-RPC) that doesn't happen.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-12-06

The step to reproduce the problem is well explained in the trac ticket : http://trac.xbmc.org/ticket/13344

For the artwork we are talking about auto generated thumbs, there's no artwork anywhere in the directory this should be returned.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-12-06

(2012-12-06, 21:01)Tolriq Wrote: The step to reproduce the problem is well explained in the trac ticket : http://trac.xbmc.org/ticket/13344
If you've read the ticket you'll have noticed that this is at least the third time I tried to reproduce the problem and it always worked and still works fine for me.

(2012-12-06, 21:01)Tolriq Wrote: For the artwork we are talking about auto generated thumbs, there's no artwork anywhere in the directory this should be returned.
The same logic applies to autogenerated thumbs. They are generated while you browse through videos in the GUI not when you start playing it. As the browsing step falls away when you use JSON-RPC to start a video no thumb is generated.
Or is there already an autogenerated thumb for the item you are trying to play?


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-12-06

I've read the ticket and even if you can't reproduce with those step I can each time Smile
I could have repost here the same reproduce pattern or just link Wink

And yes even for items who have the thumb generated this won't work.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - claymic - 2012-12-06

(2012-12-06, 20:33)Montellese Wrote:
(2012-12-06, 20:14)Montellese Wrote:
(2012-12-04, 00:04)claymic Wrote: Ok, i maked some more tests and will try to explain in my bad english, i am sorry for that.
- Situation 1 : if i am in the window HOME (xbmc) and tried to set the playcount to 0 or 1 (using my app for ipad), take between 7 or 10 seconds and i lose all the streamdetails for the movie.
- Situation 2: if i am in the window MOVIE(xbmc) and tried to set the playcount to 0 or 1 (using my app for ipad), take between 2 or 3 seconds and i dont lose the streamdetails for the movie.
- Situation 3: after lose the streamdetails in situation 1, i cant get the streamdetails for this movie anymore if i am in the window HOME, but if i go to the window MOVIE and maked another request i get all the streamdetails again.
I dont know if i explain right, i am sorry for that.
Clayton

I tried again and I get the JSON-RPC response after less than 100ms and if I'm in a GUI view where I can see the updated movie it takes around 1-2 seconds to refresh.
But I found the problem with the stream details. Will need to figure out how best to solve it.

Loosing the streamdetails should be fixed with https://github.com/xbmc/xbmc/commit/8c2223920d093bd3aadeec3172830acc6f071a42.
Thanks for test this for me Montellese
I test again, this time in two HTPCs, my interface for ipad and the Constellation for Ipad, samething for all tests, the playcount take 7,10 and sometimes 20 seconds.
I maked a clean instalation in both HTPCs and use only the skin Confluence.
When in the window HOME sometimes i get a little lockup, the screen block until the playcount update.
If i am in the window MOVIE, the screen lockup if i tried to access the Context Menu (keyboard c) after set the playcount to 0 or 1 with the app, Sometimes my app simple freeze wating the response from JSON.
This happens in both pcs and both aplications for ipad.
But if is working for your, i have to tried again, set the playcount directly from the ipad its very nice, i cant give up to get this to work Smile
Very thanks for all your help
Clayton



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-12-06

Are you using mysql and maybe a slow computer? But still 10 seconds is very long even for a slow htpc connected over a slow network connection to a slow server running mysql.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - claymic - 2012-12-06

Nop, and here i control all the home (lights,audio, video,alarm system,...) over my network with no problem, its a nice network and maked to support hard trafic.
One pc its a quad core and another is the Xtreamer Ultra 2 with a SSD, each one with 4gb of RAM.
To get all my movies, with thumbs and fanarts, take less then 1 second (800 movies in the library), samething for tvshows (5k episodes), everything works fast and nice, i only have a problem with the playcount.
Thanks for your help Montellese, i apreciate.
Clayton


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Luca Brasi - 2012-12-07

Hey guys,

it there any way to get notifications about window changes?
I would like to trigger some actions in eventghost based on that...


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-12-07

(2012-12-07, 02:07)Luca Brasi Wrote: Hey guys,

it there any way to get notifications about window changes?
I would like to trigger some actions in eventghost based on that...

Nope, no notifications on any window changes right now.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - yallah - 2012-12-07

Hi,

Still not working. Can't start movie iso via Json,

Where do you think the problem come from, work perfectly with all other format?

Thx for your help



(2012-11-28, 14:46)yallah Wrote:
(2012-11-28, 00:19)Martijn Wrote:
(2012-11-27, 22:55)yallah Wrote: Hi,

Don't why bluray iso can't open via json-rpc (working if I execute ISO from GUI)...

{"jsonrpc": "2.0", "method": "Player.Open", "params": {"item": {"file":"Z:\\Star Wars Episode III - Revenge of the Sith (2005)\\Star Wars Episode III - Revenge of the Sith (2005).iso"}}, "id": 1}

http://pastebin.com/GBAtARU8

thx for your help

If this is a movie scraped to your library and you know the dbid you could also use Player.Open through JSONRPC

Same prob;/

Use {"jsonrpc": "2.0", "method": "Player.Open", "params": {"item": {"movieid": 237 }}, "id": 1} (ISO STARWARS) no working
{"jsonrpc": "2.0", "method": "Player.Open", "params": {"item": {"movieid": 231 }}, "id": 1} (MKV SHREK) working

Tell me if prob come from outside Json-RPC. But When I start from GUI it's working :/
http://pastebin.com/JaPyHKAA




RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-12-07

Ok here's some more debug information about the empty labels. (Phone and Xbmc machine are near time synced)

Step one : Start a movie file from JSON :
Code:
2012-12-07 19:19:23.500 Verbose/JsonRpc: JsonRpc.doRequest@238: Request : {"id":1,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"smb:\/\/DISKSTATION\/Torrents\/Arrow.S01E08.FASTSUB.VOSTFR.720p.HDTV.x264-PROTEiGON.mkv"}}}
2012-12-07 19:19:23.680 Verbose/JsonRpc: JsonRpc.doRequest@254: Response : {"id":1,"jsonrpc":"2.0","result":"OK"}

All works ok (A part from thumbnail filling even if it has already been auto generated).

Logs from Xbmc : http://xbmclogs.com/show.php?id=19018

Step 2 : Stop the media (after a few seconds)

Code:
2012-12-07 19:19:46.782 Verbose/JsonRpc: JsonRpc.doRequest@238: Request : {"id":1,"jsonrpc":"2.0","method":"Player.Stop","params":{"playerid":1}}
2012-12-07 19:19:46.917 Verbose/JsonRpc: JsonRpc.doRequest@254: Response : {"id":1,"jsonrpc":"2.0","result":"OK"}

Logs from Xbmc : http://xbmclogs.com/show.php?id=19019

Step 3 : Start the media again with the same command
Code:
2012-12-07 19:20:00.117 Verbose/JsonRpc: JsonRpc.doRequest@238: Request : {"id":1,"jsonrpc":"2.0","method":"Player.Open","params":{"item":{"file":"smb:\/\/DISKSTATION\/Torrents\/Arrow.S01E08.FASTSUB.VOSTFR.720p.HDTV.x264-PROTEiGON.mkv"}}}
2012-12-07 19:20:00.376 Verbose/JsonRpc: JsonRpc.doRequest@254: Response : {"id":1,"jsonrpc":"2.0","result":"OK"}

Logs from Xbmc : http://xbmclogs.com/show.php?id=19021

The difference between the 2 logs :
Permanent tries of Xbmc to do :

Code:
19:20:00 T:6412   DEBUG: CVideoDatabase::GetMovieId (smb://DISKSTATION/Torrents/Arrow.S01E08.FASTSUB.VOSTFR.720p.HDTV.x264-PROTEiGON.mkv), query = select idMovie from movie where idFile=1996
19:20:00 T:6412   DEBUG: CVideoDatabase::GetEpisodeId (smb://DISKSTATION/Torrents/Arrow.S01E08.FASTSUB.VOSTFR.720p.HDTV.x264-PROTEiGON.mkv), query = select idEpisode from episode where idFile=1996
19:20:00 T:6412   DEBUG: CVideoDatabase::GetMusicVideoId (smb://DISKSTATION/Torrents/Arrow.S01E08.FASTSUB.VOSTFR.720p.HDTV.x264-PROTEiGON.mkv), query = select idMVideo from musicvideo where idFile=1996

On start movie then on each subsequent Player.GetProperties.

So as Mizaki pointed out as soon files have some properties saved like resume point Json tries to find the file in one of the database then don't find it and forgot to set some fields.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-12-08

VideoLibrary.SetTVShowDetails is missing the year field Smile

And I can't get VideoLibrary.SetTVShowDetails work for playcount Sad. (Either setting a positive value or 0)

Xbmc returns OK on query but does not change anything on Xbmc side (neither the show, the seasons or the episodes).


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-12-08

(2012-12-07, 20:43)Tolriq Wrote: So as Mizaki pointed out as soon files have some properties saved like resume point Json tries to find the file in one of the database then don't find it and forgot to set some fields.
The final clue to be able to reproduce the problem was to start playback through JSON-RPC's Player.Open and not through the GUI.
"thumbnail" and "fanart" still don't work because XBMC stores the information about the currently playing file in different locations and there's no easy way to merge those into one set of properties. Will have to come up with a better way for Frodo+1.

EDIT: Forgot to mention that the "label" issue is fixed in https://github.com/xbmc/xbmc/commit/c6c47ad991e5b788cdfbb7144b276ba631ffd409. You should also be able to get "streamdetails" and "resume".

(2012-12-08, 16:13)Tolriq Wrote: VideoLibrary.SetTVShowDetails is missing the year field Smile
Yup, you're right.

(2012-12-08, 16:13)Tolriq Wrote: And I can't get VideoLibrary.SetTVShowDetails work for playcount Sad. (Either setting a positive value or 0)
Hm that should probably not be there in the first place as the logic to mark all seasons/episodes within a tvshow marked is not located in the database but in the GUI code when you use the context menue or the "markwatched" action.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Tolriq - 2012-12-08

Thanks for label.

For shows this is a bad new since there's no SetSeasonDetails and I'm not sure that setting playcounts of all episodes from Json will update the season and show playcount Sad

Edit : Just tested on a small show and it did work Smile should perhaps just remove the field from schema.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2012-12-09

I just checked and actually the "year" property for tvshows is extracted from the "premiered" property so not having it in SetTvShowDetails is correct.