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 - Lunatixz - 2014-03-18

(2014-03-18, 22:12)Tolriq Wrote: Just be sure that your file is in a source and not a random location as access is denied if it's not the case Wink

I figured out why it wasn't opening (I accidentally used 'path' instead of 'file', duh), but now i'm back to square one. File opens but doesn't seek or resume to given vaule. Even using your example:
Code:
{"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item":{"file":"smb://.....mkv"},"options":{"resume":{"hours":0,"minutes":8,"seconds":8,"milliseconds":0}}}}

File opens, but always starts at the beginning... This is the same behavior I observed while testing in Frodo.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Lunatixz - 2014-03-22

Can someone knowledgeable in Json try:

Code:
{"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item":{"file":"smb://.....mkv"},"options":{"resume":{"hours":0,"minutes":8,"seconds":8,"milliseconds":0}}}}

I know it returns "ok" but does it actually seek to the set resume point?
From my experience it simply plays the file without seeking...

Thanks

::Update::

Nevermind, I figured it out. It was a problem of how the commands were stacked together and nested...


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - mikebzh44 - 2014-03-24

Does lastplayed value is not available for GetDirectory function ?

Code:
11:59:28 T:2924   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://profile/playlists/video/Cartoons.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded", "lastplayed"]}, "id": 1}
11:59:28 T:2924   DEBUG: JSONRPC: Not unique array element at index 12 and 21 in type Item.Fields.Base
11:59:28 T:2924   DEBUG: JSONRPC: Value does not match extended type Item.Fields.Base of type properties

Because this value is listed in List.Field.Files, according to the wiki :

http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v6#Files.GetDirectory

http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v6#List.Fields.Files

Thanks.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2014-03-24

(2014-03-24, 13:09)mikebzh44 Wrote: Does lastplayed value is not available for GetDirectory function ?

Code:
11:59:28 T:2924   DEBUG: JSONRPC: Incoming request: {"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "special://profile/playlists/video/Cartoons.xsp", "media": "video", "properties": ["title", "originaltitle", "playcount", "year", "genre", "studio", "country", "tagline", "plot", "runtime", "file", "plotoutline", "lastplayed", "trailer", "rating", "resume", "art", "streamdetails", "mpaa", "director", "dateadded", "lastplayed"]}, "id": 1}
11:59:28 T:2924   DEBUG: JSONRPC: Not unique array element at index 12 and 21 in type Item.Fields.Base
11:59:28 T:2924   DEBUG: JSONRPC: Value does not match extended type Item.Fields.Base of type properties

Because this value is listed in List.Field.Files, according to the wiki :

http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v6#Files.GetDirectory

http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v6#List.Fields.Files

Thanks.

Please read the output provided by XBMC. It tells you that the elements at index 12 and 21 in the array you provide are not unique. In your case both are "lastplayed" but the JSON-RPC API does not allow two elements with the same value. Remove one of them and you should be good.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - mikebzh44 - 2014-03-24

Oops, sorry :S


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - mikebzh44 - 2014-03-26

artistid and albumartistid are not retrieve with GetDirectory method and Songs or Albums smart playlists.

Playlist:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>Last Played Songs</name>
    <match>all</match>
    <rule field="lastplayed" operator="inthelast">
        <value>3 weeks</value>
    </rule>
    <order direction="ascending">lastplayed</order>
</smartplaylist>

Code:
_json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Files.GetDirectory", "params": {"directory": "%s", "media": "music", "properties": ["artistid", "albumid", "albumartistid", "dateadded"]}, "id": 1}' %(PLAYLIST))
_json_query = unicode(_json_query, 'utf-8', errors='ignore')
_json_pl_response = json.loads(_json_query)
_files = _json_pl_response.get( "result", {} ).get( "files" )
print("_files=",_files)

Result :
Code:
('_files=', [{u'filetype': u'file', u'label': u'Do I Wanna Know?', u'albumid': 2, u'file': u'G:\\Musiques\\Arctic Monkeys\\2013 - AM\\01 - Arctic Monkeys - Do I Wanna Know-.mp3', u'type': u'song', u'id': 2360}, {u'filetype': u'file', u'label': u'Rolling into deep', u'albumid': 1, u'file': u'G:\\Musiques\\Adele\\2011 - 21\\01 Rolling in the Deep.mp3', u'type': u'song', u'id': 2347}])



RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - wuench - 2014-03-30

What property values will trigger a Player.OnPropertyChanged notification? The JSONRPC documentation lists a lot of properties like time, percentage, etc. But I don't see any OnPropertyChanged notifications coming in at all so I assume it can't return those values....


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2014-03-30

(2014-03-30, 21:09)wuench Wrote: What property values will trigger a Player.OnPropertyChanged notification? The JSONRPC documentation lists a lot of properties like time, percentage, etc. But I don't see any OnPropertyChanged notifications coming in at all so I assume it can't return those values....

Right now only "shuffled" and "repeat" AFAICT. The others are properties you can retrieve through Player.GetProperties.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - wuench - 2014-03-30

Ok, thanks. That's what I figured. I know I can retrieve that info through polling, and currently do. But my driver is pushing the CPU on my Raspberry Pi by about 10-15% polling every 3 seconds so I am trying to be a little more efficient on how I poll. OnPropertyChanged looked like it solved all my problems, but it looks like I will need to get more creative and fake the time tracking. I get why you wouldn't want to push that info out in events...


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Lunatixz - 2014-04-06

::edit::


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - claymic - 2014-04-11

Hi guys,
This is already working, right ?
Quote:November 11th 2013:
Commit: Commit:85bfca0
Add Settings namespace with GetSections, GetCategories, GetSettings, GetSettingValue, SetSettingValue and ResetSettingValue
Can you guys tell me if is working for Frodo too ?
Is there a place where i can read about it ?
Thanks
Clayton


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2014-04-11

It's not available in Frodo and there's no real documentation about it except of the API definition.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - claymic - 2014-04-11

Thanks Montellese
I the code bellow to get a description of the Settings.GetSettings
Quote:{"jsonrpc":"2.0","method":"JSONRPC.Introspect","params": {"getdescriptions": true,"filter":{"getreferences":true,"id":"Settings.GetSettings","type":"method"}},"id":1}
But now i am trying to get all values that i can use on the "section" and "category" fields, can i do that using JSONRPC.Introspect ?
For get the audio output value, the user joethefox already help me
Quote:{"jsonrpc":"2.0","method":"Settings.GetSettings", "params":{"filter":{"section":"system","category":"audiooutput"}},"id":1}
Thanks again
Clayton


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - Montellese - 2014-04-11

You need to use Settings.GetSections to get a list of possible values for "section" and Settings.GetCategories to get a list of possible values for "category". Or you can look into XBMC's settings definition in your XBMC installation under system/settings/settings.xml to see what exists and what doesn't.


RE: JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC - claymic - 2014-04-14

Thanks Montellese, sorry, i was so tired when i wrote this question that i don´t read everything on the commit, now i know how it works, very cool.
Can you tell me if is already possible to request a image with a specific size ? I tried to found any information about this but i don´t found.
Thanks again
Best regards
Clayton