• 1
  • 184
  • 185
  • 186(current)
  • 187
  • 188
  • 226
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC
Aha! That is the solution. Thank you very much. So the AND and OR operator are basically prefix notations for x AND y and I have to write them like AND(x,y). If that is the case, then it is not really confusing at all to nest them.

Also, another tiny question: how do I specify a value for the "notinthelast" filter operator? Is it "7 days", "7", "07d" or something different altogether? I looked through the JSON specifications on the wiki but could not find anything that describes this.
Reply
(2013-03-04, 19:39)Anthirian Wrote: Aha! That is the solution. Thank you very much. So the AND and OR operator are basically prefix notations for x AND y and I have to write them like AND(x,y). If that is the case, then it is not really confusing at all to nest them.
Exactly.

(2013-03-04, 19:39)Anthirian Wrote: Also, another tiny question: how do I specify a value for the "notinthelast" filter operator? Is it "7 days", "7", "07d" or something different altogether? I looked through the JSON specifications on the wiki but could not find anything that describes this.
Good question. I'll have to try that myself in the GUI and see what it expects.
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
Apparently it expects an integer, for example running this request

Code:
http://localhost:8000/jsonrpc?request={"jsonrpc":"2.0","method":"VideoLibrary.GetMovies","params":{"properties":["playcount","lastplayed","resume","dateadded"],"filter":{"and":[{"field":"playcount","operator":"is","value":"0"},{"field":"dateadded","operator":"inthelast","value":"7"}]}},"id":1}

yields this response

Code:
{"id":1,"jsonrpc":"2.0","result":{"limits":{"end":2,"start":0,"total":2},"movies":[{"dateadded":"2013-02-28 21:43:01","label":"The Bay","lastplayed":"","movieid":42,"playcount":0,"resume":{"position":0,"total":0}},{"dateadded":"2013-03-01 13:37:08","label":"Zero Dark Thirty","lastplayed":"","movieid":43,"playcount":0,"resume":{"position":0,"total":0}}]}}

which matches my download history for the last 7 days.
Reply
pre-13.0
As an FYI, starting with Frodo stable we are using a new versioning system (<major>.<minor>.<bugfix>) for the JSON-RPC API. Frodo stable is version 6.0.0 and from now on with every bugfix the <bugfix> part of the version is increased, with every feature addition to the API, the <minor> version is increased (and the <bugfix> version reset to 0) and with every backwards incompatible change, the <major> version is increased. This should allow third party devs to better rely on the version provided by JSONRPC.Version and to e.g. show a warning or error if the version doesn't match a specific version required by the client. Furthermore it should make debugging easier as I can ask 3rd party devs for the version they are using and will know immediately, which features/fixes are included in that version and which arent.

Version 6.0.1

February 11th 2013:
Commit: 44916b33908f77692d8838446035de3e3bc10ca1
Fix the result of Player.GetProperties with param "currentaudiostream" for video without an audio stream (index = -1).

February 19th 2013:
Commit: 7b9ab8a85fd2b6030e6cf2659ff16380afef3996
Add missing "xbmc.pvrclient" entry to Addon.Types enum

Version 6.0.2

February 24th 2013:
Commit: adc54a9873d213b052f395072c5532781c917648
Correct Player.PlayPause behavior: In current implementation using play parameter as boolean won't force the playerspeed to 1 as it should. This PR correct this so that using a bool parameter act as the toggle and provide the same behavior as GUI or EventServer.

Version 6.0.3

February 27th 2013:
Commit: bee7aeb42812c21655368923ee1047d8ffbc02da
fix passing of paths to builtin methods (fixes #14066)

Version 6.1.0

March 7th 2013:
Commit: ff3611c86b68103abd0cde4142d2b4cdf5b9690c
Add support for limits to Files.GetDirectory

March 7th 2013:
Commit: 16767de3dad0654db94eef04732d9e4f21bd04e9
add compilationartist property to AudioLibrary.GetArtists
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
Is there a way to retrieve a list of playslists (smart and regular)? I have looked through this thread and it appears that Playlist.GetPlaylists only returns the 3 internal playlists. There are references to using Files.GetDirectory but that is no longer available. And there are references to adding xxxLibrary.GetPlaylists commands but those aren't there yet either.

Is this possible in Frodo?
Reply
Files.GetDirectory is still the only way to do that Smile

special://videoplaylists and special://musicplaylists are your friends.
Reply
Oh ok, Files.GetDirectory is not listed in the V6 docs as available so I figured it was gone...
Reply
http://wiki.xbmc.org/index.php?title=JSO...tDirectory ??
Reply
Ah my bad, I was scrolling too far into the globals section.... Thanks.

Works great!

Here's an example for anyone else trying to do it...
Code:
REQUEST
{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory":"special://musicplaylists"}, "id": 1}

RESPONSE (2 Smart Playlists)
{"id":1,"jsonrpc":"2.0","result":{"files":[{"file":"special://profile/playlists/music/Blues Mix.xsp","filetype":"directory","label":"Blues Mix","type":"unknown"},{"file":"special://profile/playlists/music/Rock Mix.xsp","filetype":"directory","label":"Rock Mix","type":"unknown"}],"limits":{"end":2,"start":0,"total":2}}}
Reply
(2013-03-08, 17:16)wuench Wrote: Is there a way to retrieve a list of playslists (smart and regular)? I have looked through this thread and it appears that Playlist.GetPlaylists only returns the 3 internal playlists. There are references to using Files.GetDirectory but that is no longer available. And there are references to adding xxxLibrary.GetPlaylists commands but those aren't there yet either.

Is this possible in Frodo?

Why is Files.GetDirectory no longer available? It's currently the only way I know of to retrieve playlists.

EDIT: NVM didn't see the other responses.
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.

I'm trying to get Artist ID from Albums smart playlist.

I'm using this code :

Code:
_json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "%s", "media": "music", "properties": ["title", "description", "albumlabel", "artist", "artistid", "genre", "year", "thumbnail", "fanart", "rating", "playcount", "dateadded"]}, "id": 1}' %(PLAYLIST))

But artistid is not returned Sad

Same thing with getting AlbumArtistID or File from song :

Code:
_json_query = xbmc.executeJSONRPC('{"id":1, "jsonrpc":"2.0", "method":"AudioLibrary.GetSongs", "params":{"filter":{"albumid": %s }},"properties":["albumartistid","file"]}}' %_albumid)

Only songid and label fields are returned :S

EDIT : Get it. Sorry, properties were not at the right place. Correct code :

Code:
_json_query = xbmc.executeJSONRPC('{"id":1, "jsonrpc":"2.0", "method":"AudioLibrary.GetSongs", "params":{"filter":{"albumid": %s}, "properties":["albumartistid", "file"]}}' %_albumid)

EDIT 2 : But ArtistID is not returned by Files.GetDIrectory method.
Sorry for my english, but, you know, I'm French so ...

Main HTPC : Odroid-C2 running CoreELEC with Titan Bingie
Secondary HTPC : Freebox Mini 4K running Android TV with Titan Bingie
Reply
I'm writing an external Python script that calls the JSON methods to perform library maintenance tasks (refresh etc.)

Is there any way to batch library scans, for example I'd like to initiate the scan of two sub directories as a single batched request, eg.:

Code:
[
  {"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": {"directory": "nfs://192.168.0.3/share/TV Serials/Arrow/Season 1"}, "id": 1},
  {"jsonrpc": "2.0", "method": "VideoLibrary.Scan", "params": {"directory": "nfs://192.168.0.3/share/TV Serials/The Big Bang Theory/Season 6"}, "id": 2}
]

and while I get the following responses:

Code:
[
  {"jsonrpc": "2.0", "id": 1, "result": "OK"},
  {"jsonrpc": "2.0", "id": 2, "result": "OK"}
]

the only directory that is scanned is that of the first request, the second scan request is not actioned at all (its simply ignored).

Alternatively, is it possible for a Python script to receive a notification indicating when a scan is complete, so that it can proceed with the next directory scan? I know there is the VideoLibrary.OnScanFinished notification but I'm yet to discover how I can use this from a Python script (is there an example anywhere? I appreciate I'll need some sort of web server/socket to listen for a response).

If receiving a notification is not possible, what about polling XBMC to determine when the scan has completed?

Failing all other alternatives, can a library scan be requested that completes synchronously (ie. the caller is blocked until the scan is complete) so that scans of individual directories can be performed sequentially?
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
Queueing library scans is currently not possible. As you mentioned yourself you can kick of one scan, then wait for the VideoLibrary.OnScanFinished notification and then kick off another one. The notifications can only be received through a TCP socket or WebSocket connection right now.
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
(2013-03-15, 10:24)Montellese Wrote: Queueing library scans is currently not possible. As you mentioned yourself you can kick of one scan, then wait for the VideoLibrary.OnScanFinished notification and then kick off another one. The notifications can only be received through a TCP socket or WebSocket connection right now.

OK thanks.

Regarding the notifications, how would I inform XBMC that I want to receive them (either on a TCP socket or WebSocket), should I call the VideoLibrary.OnScanFinished method then wait for notifications to be sent on the same ip and port? Or is the notification automatically sent to each client that initiated the scan? So if a client 192.68.0.20 is initiating a scan on xbmc server 192.168.0.8:8080, where will the notification be sent, and on what port? Sorry for the basic questions, it's just that notifications seem like a bit of a black art! Smile
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
The notifications are sent to any client that has an open two-way connection (TCP socket or WebSocket) to the XBMC client sending the notifications.
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
  • 184
  • 185
  • 186(current)
  • 187
  • 188
  • 226

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