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

  Thread Rating:
  • 7 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Montellese Online
Team-XBMC Developer
Posts: 2,778
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #2051
Sunday, July 1st 2012:
Commit: 64aea4d83de8899e2449
  • added "fanart" and "thumbnail" parameters to VideoLibrary.SetFooDetails

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
Mizaki Offline
Fan
Posts: 662
Joined: Apr 2011
Reputation: 12
Post: #2052
I don't know if the additional changes you made to the limited sorting after the accidental commit has made the difference but, using the same limited (50 movies a time) request between Eden and Frodo, it takes about twice as long. I'm sure when I tried it the previous time it was much quicker than Eden. Hopefully someone else can confirm that Eden is quicker with limits than Frodo?

I do only have 650 odd movies so maybe someone with a large library will see the benefit more.

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,778
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #2053
Are you running OSX by chance? For whatever reasons all requests like VideoLibrary.GetFoo take longer on OSX in pre-Frodo. On win32 and linux it's fine.
As the new merge window opened today I pulled my PR into master which will use the new sorting/limiting functionality for JSON-RPC and this time for real Wink It should be in tomorrows nightly build.

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
Mizaki Offline
Fan
Posts: 662
Joined: Apr 2011
Reputation: 12
Post: #2054
Using Linux and just pulled and built Smile

Example:
Code:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "limits": { "start" : 200, "end": 250 }, "properties" : ["rating", "thumbnail", "playcount", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": 1}
Takes on average 200ms with Eden and 700ms with git. I took the rough average with 5 requests.

And for some reason:
Code:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "limits": { "start" : 350, "end": 400 }, "properties" : ["rating", "thumbnail", "playcount", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": 1}
gives me a segfault.

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
(This post was last modified: 2012-07-01 19:24 by Mizaki.)
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,778
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #2055
On my win32 machine (i7) that exact request takes around 65-70 ms with current master, around 280-300 ms with the nightly build from June 26th and around 120-140 ms with Eden. If I run it in debug mode it takes around 250-300ms. The very first JSON-RPC request is always slow(er) because the webserver only starts setting up the simultaneous threading stuff when the first HTTP request arrives.

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
Mizaki Offline
Fan
Posts: 662
Joined: Apr 2011
Reputation: 12
Post: #2056
I turned on debug in Eden to check but the times were roughly the same. Hopefully someone else using Linux can compare. The only difference is I run git with portable but I can't imagine that would make the difference. I'm sure when I tried the changes previously the times were around 100ms. If I can find anything definitive, skin, addons etc. I'll let you know.

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,778
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #2057
I'm running in portable mode as well. When developing I run in portable mode in Confluence but both Eden and current master have the same movie sources with approximately 550 movies. Skins etc shouldn't have anything to do with this. The only other thing that can slow JSON-RPC request over HTTP down is if there are a lot of other requests at the same time. IIRC we handle 4 simultaneous requests (sounds low but that's what a lot of the big webservers like Apache etc do by default as well). But as there was no simultaneous HTTP request handling in Eden it would even be slower there.
I can try on linux sometime next weekend (got 4 exams coming up next week).

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
Senior Member
Posts: 214
Joined: Mar 2012
Reputation: 7
Location: Switzerland
Post: #2058
Hi,

I was trying to update the playcount from a movie in order to mark a video as watched/unwatched in xbmc. (using latest nightly build)

Set movie as watched: Works, but lastplayed field in db is empty, shouldn't this be updated to the current date if playcount was 0 before?
Code:
curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.SetMovieDetails\", \"params\" : { \"movieid\" : 1, \"playcount\" : 1 }, \"id\" : 1 }" http://127.0.0.1:8080/jsonrpc | python -mjson.tool

Set movie as watched: works
Code:
curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.SetMovieDetails\", \"params\" : { \"movieid\" : 1, \"playcount\" : 1, \"lastplayed\" :  \"2012-07-02 11:25:37\" }, \"id\" : 1 }" http://127.0.0.1:8080/jsonrpc | python -mjson.tool

Setting the movie as unwatched does not work. Tried the following two requests
Code:
curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.SetMovieDetails\", \"params\" : { \"movieid\" : 1, \"playcount\" : 0,  \"lastplayed\" :  \"\" }, \"id\" : 1 }" http://127.0.0.1:8080/jsonrpc | python -mjson.tool

Code:
curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.SetMovieDetails\", \"params\" : { \"movieid\" : 1, \"playcount\" : 0 }, \"id\" : 1 }" http://127.0.0.1:8080/jsonrpc | python -mjson.tool

both return
Code:
{
    "error" : {
        "code" : -32602,
        "data" : {
            "method" : "VideoLibrary.SetMovieDetails",
            "stack" : {
                "message" : "Received value does not match any of the union type definitions",
                "name" : "playcount",
                "type" : ["null", "integer"]
            }
        },
        "message" : "Invalid params."
    },
    "id" : 1,
    "jsonrpc" : "2.0"
}[/quote]
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,778
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #2059
(2012-07-02 11:56)Millencolin007 Wrote:  Hi,

I was trying to update the playcount from a movie in order to mark a video as watched/unwatched in xbmc. (using latest nightly build)

Set movie as watched: Works, but lastplayed field in db is empty, shouldn't this be updated to the current date if playcount was 0 before?
Thanks for mentioning it. I changed it in master.

(2012-07-02 11:56)Millencolin007 Wrote:  Setting the movie as unwatched does not work. Tried the following two requests
Code:
curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.SetMovieDetails\", \"params\" : { \"movieid\" : 1, \"playcount\" : 0,  \"lastplayed\" :  \"\" }, \"id\" : 1 }" http://127.0.0.1:8080/jsonrpc | python -mjson.tool

Code:
curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"VideoLibrary.SetMovieDetails\", \"params\" : { \"movieid\" : 1, \"playcount\" : 0 }, \"id\" : 1 }" http://127.0.0.1:8080/jsonrpc | python -mjson.tool

both return
Code:
{
    "error" : {
        "code" : -32602,
        "data" : {
            "method" : "VideoLibrary.SetMovieDetails",
            "stack" : {
                "message" : "Received value does not match any of the union type definitions",
                "name" : "playcount",
                "type" : ["null", "integer"]
            }
        },
        "message" : "Invalid params."
    },
    "id" : 1,
    "jsonrpc" : "2.0"
}
Found the bug and fixed it as well. Thanks for letting me know.

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
Mizaki Offline
Fan
Posts: 662
Joined: Apr 2011
Reputation: 12
Post: #2060
When you have a spare minute I'm still getting a segfault with pre-frodo.
Code:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "limits": { "start" : 303, "end": 349 }, "properties" : ["rating", "thumbnail", "playcount", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": 1}
If "start" is <303 it seems to work. I ran gdb and crashed it. I have no idea with gdb so this may be no help whatsoever.
Code:
std::_Rb_tree<Field, std::pair<Field const, CVariant>, std::_Select1st<std::pair<Field const, CVariant> >, std::less<Field>, std::allocator<std::pair<Field const, CVariant> > >::_M_erase (this=0xad1f7e8, __x=0x1)
    at /usr/include/c++/4.6/bits/stl_tree.h:1064
1064              _M_erase(_S_right(__x));
http://pastebin.com/KRiYz30A

Anything else I can do to try and find the problem?

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
Post Reply