• 1
  • 189
  • 190
  • 191(current)
  • 192
  • 193
  • 226
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC
Well, use GUI.ActivateWindow with "visualization" works for music. But if you guys know any way to do this for video and music with one single command, let me know please.
Clayton
Reply
Ok, guys i found a way to put this in a single function. Thanks anyway
Quote:self.showOsdPlayer = function(){
//self.rpc("Input.ShowOSD", {}, self.logReplyData);
self.rpc("Player.GetActivePlayers", {}, function(data) {
if(data.result.length !== null && data.result.length !== 0){
self.currentPlayer = data.result[0].type;
if(self.currentPlayer == "audio"){
self.openWindow("visualisation");
} else if(self.currentPlayer == "video"){
//fullscreenvideo
self.openWindow("fullscreenvideo");
}
}
})
}
Reply
Some users of my app reported that file listing is very slow. After some searching I found that listing a directory with media = music is much slower than requesting the same directory as media = files. By much slower I mean at least 10 times slower.

Example of a fast request using media = files:
Code:
curl  -H "Content-Type: application/json"  -d "{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"Files.GetDirectory\",\"params\":{\"directory\":\"/home/xbmc/Media/Music/\",\"media\":\"files\",\"properties\":[]}}" http://127.0.0.1:8080/jsonrpc

Same request using media = music
Code:
curl  -H "Content-Type: application/json"  -d "{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"Files.GetDirectory\",\"params\":{\"directory\":\"/home/xbmc/Media/Music/\",\"media\":\"music\",\"properties\":[]}}" http://127.0.0.1:8080/jsonrpc

I did not specify any properties on purpose, especially not thumbnails since they are/where known to slow down the response times.

Is this a known issue? For larger directories this makes media = music basically unusable

Tested on XBMC 12.1 Git:0d373cc (Compiled: Mar 17 2013) (Ubuntu version from repo)
Reply
This is normal Sad

If media is set to video or music then there's database access to find the media in database to find ID and all associated details.

And for music this is horrible on low end devices due to not optimal searches and finding lots of details about albums / artists and genres Sad
Reply
Haha, you had some users complaining about that already ;-)

It definitively kills a raspberry pi but it can also be very slow on faster machines. Maybe I will just let the user choose between thumbnails or speed ;-)
Reply
I added a file mode option in the sort menu to address that so users can easily switch for big folders Smile

Even for videos in my temp dl source of about 600 items, it's instant with file mode, 4 sec in video mode on the fast HTPC, but 10 sec in file mode and so long I don't have patience on my RPI :p
Reply
I have seen that xbmc sometimes does return the volume as float instead of an int when calling Application.GetProperties. In the json introspect file it is defined as int. Has something been changed recently?

Code:
curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"Application.GetProperties\", \"params\" : { \"properties\" : [ \"volume\", \"muted\" ] }, \"id\" : 1 }" http://xbmc:80/jsonrpc | python -mjson.tool

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "muted": false,
        "volume": 15.000000953674316
    }
}

Edit:
Tried on: XBMC for Raspbmc 13.0-ALPHA3 Git:20130429-a7a45c4
Reply
(2013-05-03, 17:43)Millencolin007 Wrote: I have seen that xbmc sometimes does return the volume as float instead of an int when calling Application.GetProperties. In the json introspect file it is defined as int. Has something been changed recently?

Code:
curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"Application.GetProperties\", \"params\" : { \"properties\" : [ \"volume\", \"muted\" ] }, \"id\" : 1 }" http://xbmc:80/jsonrpc | python -mjson.tool

{
    "id": 1,
    "jsonrpc": "2.0",
    "result": {
        "muted": false,
        "volume": 15.000000953674316
    }
}

Edit:
Tried on: XBMC for Raspbmc 13.0-ALPHA3 Git:20130429-a7a45c4

Nice find. IIRC the return value of CApplication::GetVolume() has changed a while ago from an integer to a float which also affects JSON-RPC. I'll make sure it will return int again.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
Hi
Anyway to control the 3D option using JSON ? How are you guys controlling this ?
Thanks
Reply
@Montellese:

I'm running the Artwork Downloader addon (AD) on a freshly scanned in media library, and AD is incredibly slow - bear with me, this is about JSON (eventually).

It's not the downloading of artwork from fanart.tv that is the cause of the delays, as AD isn't actually downloading any artwork (I have local files unchecked) - it's simply assigning the remote artwork URLs to the database, using JSON, however my database (MySQL) is showing a vast amount of activity, so it seems that a (relatively) simple insert is resulting in a cascade of database updates - is this correct?

Here's the debug log for one movie, which is having just one new artwork item added (a clearart url), and sure enough there is a simply crazy amount of database activity for what, on the surface, appears to be such a simple addition. Much of the activity relates to actors, which should already have been scanned in and configured previously, so why are actors being updated/inserted when unrelated artwork items are being added?

Is this a bug, by design, or simply an inefficiency in the database that could/should be improved? I notice it deletes a load of links at the beginning of the transaction, so it seems to be "clearing down" the movie before reinserting it, is this absolutely necessary when adding something simple like a new artwork, or for example, changing a runtime duration? Granted, it's probably the "easiest" implementation, but certainly also the least efficient.

Could some "smart" database optimisations be added so that much of this overhead is avoided when not required, either on a JSON field-by-field basis (not nice, but certainly a quick win). Why clear down actors, for example, when no actor fields are being modified by JSON?

All of this unnecessary database activity means that it takes 11-12 seconds to add one artwork item to one movie, which is an activity that should take a few tens of milliseconds. And this isn't an underpowered MySQL server either.

Apologies that this isn't explicitly a JSON issue, and database updates may not be within your remit (not sure who area this falls under, jmarshall perhaps?), but there seems to be an incredible inefficiency here which straddles JSON and also the database and which, if eliminated or at the very least significantly reduced, would dramatically improve the performance of certain common activities.

What's worse is that an addon like AD, when inserting both a clearlogo and a clearart artwork item, will perform this as two separate JSON requests, meaning that the movie/tvshow is removed from the database and then reinserted not once but twice - once when adding the first artwork item, then again when adding the second artwork item. Since this particular add-on can insert several different types of artwork for each movie/tv show, this means the run time can increase almost exponentially...

To be honest, if I was writing the AD add-on, I'd bypass JSON and go straight to the database to avoid taking such a massive performance hit.

Maybe optimising database updates could be considered as a GSOC 2013 proposal (although probably too late to accept now).
Texture Cache Maintenance Utility: Preload your texture cache for optimal UI performance. Remotely manage media libraries. Purge unused artwork to free up space. Find missing media. Configurable QA check to highlight metadata issues. Aid in diagnosis of library and cache related problems.
Reply
http://forum.xbmc.org/showthread.php?tid...pid1402178 Smile

There's quite some place for optimization but I was explained that this is not what is causing the delay and the debate moves on another thing that could be optimized too but still no answer on both things Smile

All those actions are also done for a change in playcount Smile
Reply
Here, it take almost 10 seconds to update a playcount of a movie, since my app involve many others process, like control all the automation, i will have to plan how i will manage this in the future.
Reply
According to some reports I got it seems something changed in Gotham about "VideoLibrary.GetTVShows"

It now returns multiple items for one show if spread over multiple directory and not like before one of them.

Is this new way normal and will be kept ? (If yes any idea of when it was changed to try to handle this correctly ?)
Reply
Well I was thinking winter was over Smile

Actually the problem is worse :

Code:
{"jsonrpc":"2.0","method":"VideoLibrary.GetTvShows","id":"1","params":{"properties":["genre","episode","playcount"],"sort":{"ignorearticle":true,"method":"sorttitle","order":"ascending"},"limits":{"start":0,"end":2}}}

Gives

Code:
{"id":"1","jsonrpc":"2.0","result":{"limits":{"end":2,"start":0,"total":705},"tvshows":[{"episode":15,"genre":["Comedy"],"label":"2 Broke Girls","playcount":0,"tvshowid":513}]}}

Notice the limits : I ask for 2, the answer say there's 2 and a 705 total but only gives 1 back (705 total is the number of Tv Show Folders)

This leads to a important bug Smile

So now if you request with limits (that is needed for correct performances on large library for rPi or aTv) you get the multiple entries with different values for example : (I ask the 2 next items in real asked chunks are bigger but you got the idea)

Code:
{"jsonrpc":"2.0","method":"VideoLibrary.GetTvShows","id":"1","params":{"properties":["genre","episode","playcount"],"sort":{"ignorearticle":true,"method":"sorttitle","order":"ascending"},"limits":{"start":3,"end":5}}}

You get :

Code:
{"id":"1","jsonrpc":"2.0","result":{"limits":{"end":5,"start":3,"total":705},"tvshows":[{"episode":4,"genre":["Comedy"],"label":"2 Broke Girls","playcount":0,"tvshowid":888}]}}

You got a second time the same show but with different episode number and id Smile (Same difference for most of the fieds like last played ....).
Reply
I'll have to investigate if someone removed the aggregation of multiple identical tvshow items which was present in CVideoDatabase::GetTvShowsByWhere().
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
  • 1
  • 189
  • 190
  • 191(current)
  • 192
  • 193
  • 226

Logout Mark Read Team Forum Stats Members Help
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC8