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
spike411 Offline
Junior Member
Posts: 12
Joined: Apr 2011
Reputation: 0
Location: Prague, Czechia
Post: #1711
Thanks, Montellese, my search-fu was weak today. The proposed solution seems OK.
find quote
mikebzh44 Online
Posting Freak
Posts: 1,751
Joined: Nov 2011
Reputation: 47
Location: Nantes - France
Post: #1712
Hello.

I want to filter partially watched movies (movies started to watched but not finished) in playlist so I use :
Code:
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "%s", "media": "video", "properties": ["year", "runtime", "file", "playcount", "rating", "plot", "fanart", "thumbnail", "resume", "trailer"]}, "id": 1}' %(_playlist))
But every movie have the following resume property :
Code:
u'resume': {u'position': 0, u'total': 0}
I have started a movie, fast forwarded it and then stoped it.
When I click to view it, XBMC ask me if I want to watch it from start or from 21:12

So where can I found the information "this movie have been watched for 1272 seconds" ?

Thanks.

Sorry for my english, but, you know, I'm French so ...

(This post was last modified: 2012-02-15 21:18 by mikebzh44.)
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1713
It should be in the "resume" property. I just tested it with one of my movies and this is what I get from VideoLibrary.GetMovies, VideoLibrary.GetMovieDetails and Files.GetDirectory:
Code:
"resume": { "position": 1849.088134765625, "total": 5024 }
I haven't tested it with smartplaylists though.

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
mikebzh44 Online
Posting Freak
Posts: 1,751
Joined: Nov 2011
Reputation: 47
Location: Nantes - France
Post: #1714
Montellese Wrote:It should be in the "resume" property. I just tested it with one of my movies and this is what I get from VideoLibrary.GetMovies, VideoLibrary.GetMovieDetails and Files.GetDirectory:
Code:
"resume": { "position": 1849.088134765625, "total": 5024 }
I haven't tested it with smartplaylists though.

I think that is a bug Sad

Request made by GetDirectory on a playlist :
Code:
{u'rating': 3.7999999523162842,
u'fanart': u'special://masterprofile/Thumbnails/Video/Fanart/d9db9c4e.tbn',
u'filetype': u'file',
[b]u'resume': {u'position': 0, u'total': 0},[/b]
u'label': u'Drive',
u'thumbnail': u'special://masterprofile/Thumbnails/Video/d/d9db9c4e.tbn',
u'file': u'C:\\Vid\xe9os\\Films\\Drive\\Drive.mkv',
u'year': 2011,
u'playcount': 0,
u'runtime': u'100',
u'type': u'movie',
u'id': 192,
u'trailer': u'http://hd.fr.mediaplayer.allocine.fr/nmedia/18/83/93/95/19243476_fa1_vf_sd_001.flv'
}
Request made by GetMovieDetails on the specific movie :
Code:
{u'moviedetails': {[b]u'resume': {u'position': 1271.79809570312[/b]5, u'total': 6024},
u'movieid': 192,
u'label': u'Drive'}}})

Sorry for my english, but, you know, I'm French so ...

find quote
jmarshall Offline
Team-XBMC Developer
Posts: 26,228
Joined: Oct 2003
Reputation: 177
Post: #1715
The resume point is returned only if needsCast is set true in GetDetailsForMovie() et. al.

@Montellese: perhaps the additional info isn't being fetched for this field?

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
Montellese Offline
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1716
Yeah it probably isn't fetched for smartplaylists but I'm not sure if I want to fix that. The problem with retrieving the extra info ("resume", "sets", "cast" etc) is that the time it takes to retrieve the information skyrockets. This is ok for GetMovieDetails because you only retrieve one movie and it's information. It is also acceptable for VideoLibrary.GetMovies because I can first check whether we actually need to retrieve the extra info and if not I don't set the needsCast flag in the request to the database. But I don't have this kind of information when retrieving smartplaylists (which is done in XBMC's VFS) so enabling that flag by default will slow down loading every smartplaylist independent of whether this happens through JSON-RPC or the XBMC GUI. So it kind of is a bug but only because it would worsen the smartplaylist experience overall.

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
bthusby Offline
Senior Member
Posts: 226
Joined: Feb 2011
Reputation: 2
Location: Norway
Post: #1717
Is JSON-RPC inherently a bit slow/heavy (bottleneck) when you have a large library of TV Shows?

I was given this explanation in another thread concerning the "On-deck" -feature, a script that shows which episodes I should watch based on what show I'm normally watching, and which is the next unwatched episode in those TV shows.

The script seems to have some performance issues / delay on the ATV2. I also use a MySQL DB on a NAS for my libraries.

BT :)
(This post was last modified: 2012-02-16 16:57 by bthusby.)
find quote
Martijn Offline
Team Kodi
Posts: 11,241
Joined: Jul 2011
Reputation: 162
Location: Dawn of time
Post: #1718
bthusby Wrote:It seems to have some performance issues on the ATV2.

An ATV2 just hasn't got much ponies. If you want power better buy somethnig better

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

For your mediacenter artwork go to
[Image: fanarttv.png]
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1719
Obviously the larger your library is the longer it takes to retrieve all the tvshows in it. Furthermore the watchlist script first retrieves all the tvshows and then for every tvshow it retrieves all the episodes. So the more tvshows you have the more it has to go through. And the more episodes there are in every show the longer it takes to process every show. You can't expect it to take the same time to go through all episodes of 10 tvshows compared to all episodes of 50 tvshows.

Furthermore the ATV2 isn't really popular for being very fast or having enough power to do everything XBMC offers. If you don't want to spend more money on your htpc you'll have to live with the fact that it won't be able to do everything as fast as if you spent more money on something faster/better.

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
bthusby Offline
Senior Member
Posts: 226
Joined: Feb 2011
Reputation: 2
Location: Norway
Post: #1720
Wow, that is impressive response time from the XBMC team Smile

I have a Win 7 PC work horse with XBMC installed, sitting in the next room, but I like the ATV2 due to its simplicity. I don't have to turn on anything and wait for boot-up, and be nagged by updates from Acrobat, Sun and Itunes every other week... Wink

Maybe it is possible to optimize the JSON parsing by not go through the whole library each time? This obviously concerns the implementation of the script and not JSON-RPC as such.

Is JSON-RPC implemented in XBMC using Python?
And if so, is it simplejson which is used in Python, or the allegdely faster python-cjson or ultrajson? I'm unfortunately not an expert.


A lot of people use ATV2, Ipad etc these days for XBMC, and I hope performance and efficiency will be addressed where it can Smile

BT :)
(This post was last modified: 2012-02-16 17:23 by bthusby.)
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1721
JSON-RPC does not yet provide any filtering functionality but once that's possible I'm sure scripts like watchlist can be improved to only fetch as much data through JSON-RPC as necessary. JSON-RPC is still very young but it's contantly growing (once the feature freeze is over Wink).

But still things can only be optimised so much and people have to keep and mind that a low-end device like an ATV2, an iPad and most embedded devices (compared to a normal computer) does not provide as much power as other systems do. Every system has a drawback, one has a fast boot-time but not much ponies and the other has a longer boot-time but enough power to handle anything you throw at it.

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
bthusby Offline
Senior Member
Posts: 226
Joined: Feb 2011
Reputation: 2
Location: Norway
Post: #1722
Montellese Wrote:JSON-RPC does not yet provide any filtering functionality but once that's possible I'm sure scripts like watchlist can be improved to only fetch as much data through JSON-RPC as necessary. JSON-RPC is still very young but it's contantly growing (once the feature freeze is over Wink).

But still things can only be optimised so much and people have to keep and mind that a low-end device like an ATV2, an iPad and most embedded devices (compared to a normal computer) does not provide as much power as other systems do. Every system has a drawback, one has a fast boot-time but not much ponies and the other has a longer boot-time but enough power to handle anything you throw at it.

Thanks for answer.

Yes, I understand that the ATV2 is a light weight box, and I use it with the Quartz skin which is brilliant for low performance purposes.

I'm looking forward to the natural evolution of more optimal code for handling Libraries / DB queries and parsing of filtered JSON-RPC in the future. In my opinion this is core functionality that should be made absolutely as efficient as possible Smile

BT :)
find quote
doozer Offline
Junior Member
Posts: 32
Joined: Jun 2011
Reputation: 0
Post: #1723
Will future releases notify the user when changes are made to the playlist, or did I miss something in the docs?

Something like Playlist.OnUpdate perhaps?
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1724
Something like this will be available once the whole playlist handling has been refactored inside XBMC. Currently there are too many entry points to cover.

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
Montellese Offline
Team-XBMC Developer
Posts: 3,685
Joined: Jan 2009
Reputation: 34
Location: Switzerland
Post: #1725
Tolriq Wrote:About this ticket Smile

I've got a new need that comes with it, it was already discussed before i think but can't remember when, and get into this new need Sad

Do you think it's possible for some of the player operations to add the support of PlayerId -1 that will pause / play whatever is currently running, even if music and pictures are running ?

See : http://forum.xbmc.org/showthread.php?p=1...ost1018502 for more details of why it may be needed.

One solution actually since playerid are limited to 1 2 3 is to send a batch of the 3 commands, but perhaps the -1 would be more coder friendly.

Please add a feature request ticket for this. I can't guarantee though that it will ever be added because I think it will make people lazy and nobody will ever care to check Player.GetActivePlayers() before calling Player.PlayPause() so it is very likely to be "abused".

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
Post Reply