Working JSON RPC API Examples - 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: Working JSON RPC API Examples (/showthread.php?tid=157996) |
RE: Working JSON RPC API Examples - t4_ravenbird - 2017-03-10 this part is not valid json : Code: {"properties": "directory":"home", "media":"video"} these are valid json (but not necessarily what the command expects) Code: { "properties": { "directory":"home" } , "media":"video" } this is a nice place to check your syntax : http://www.jsoneditoronline.org/ RE: Working JSON RPC API Examples - lumiknight - 2017-03-30 need an example of the json rpc commands to get audio and video library when kodi is playing items from a upnp server. also need the commands to get the file pathways for direct play through the json rpc. any insight would be useful. thanks RE: Working JSON RPC API Examples - NeoNator - 2017-05-06 Has anyone got Player.Seek working with Player.Position.Percentage because i just want to restart the video from the start but cant modify the examples from earlier to make it work, i just dont understand jsonrpc at all and im not a coder ( {"jsonrpc":"2.0","method":"Player.Seek","params":{ "playerid":1,"value":"smallforward"},"id":1} ) RE: Working JSON RPC API Examples - wrinkols - 2017-05-10 I've done a lot of research with no results. Does anybody know if JSON-RPC can be used to parse the current play queue (regardless of whether it is random media or a playlist)? My preference would be to use Python but I have been unsuccessful finding a method for doing this. Ideally I would parse the current queue and then save it to a discrete playlist for use in the future. Any help would be appreciated. I looked through the JSON-RPC library and didn't see anything that seemed related. I'm hoping there's something I missed. ---EDIT/UPDATE--- I was able to get Playlist.GetItems to work for me for getting the information. The next question I have is that if I'm making my calls from Python is there an ideal way to do it or should I just be using urllib2 ? Thanks RE: Working JSON RPC API Examples - wrinkols - 2017-05-20 I figured I'd add an update in case anyone was lurking. For anyone who was hoping for a feature like this, I hacked together something for autoexec.py that will autoresume your media after shutting down/restarting Kodi. Caveats are that you have to make userdata/playlists writeable and you have to enable http services. https://pastebin.com/LCVHS90E RE: Working JSON RPC API Examples - ednt - 2017-05-22 Hi, I can not find out how to show a picture via smb when a username and password is needed. If I set it once as library via 'remotecontrol' it works. But after a reboot I need to add this library again. Is there a trick to set username and password directly in the json string? Code: {"file":"smb://fs2/tv-eingang/TV-Bild.jpg"} or from where is the used username and password? I tried this: Code: {"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item":{"file":"smb://user:password@fs2/tv-eingang/TV-Bild.jpg"}}} If I use this: Code: {"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item":{"file":"'smb://user:password@fs2/tv-eingang/TV-Bild.jpg'"}}} I get: Code: {"id":1,"jsonrpc":"2.0","result":"OK"} Any ideas? Thanks in advance RE: Working JSON RPC API Examples - ednt - 2017-05-22 Next try: I mounted now the smb share to /storage/pictures This works all the time. It is available after a reboot. Code: {"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item":{"file":"file://storage/pictures/TV-Bild.jpg"}}} returns no answer In the kodi log file (/storage/.kodi/temp/kodi.log) I can read: Quote:ERROR: COMXImageFile::ReadFile file://storage/pictures/TV-Bild.jpg not found But the file is there. Checked with Code: ls -al /storage/pictures/TV-Bild.jpg Quote:-rwxr-xr-x 1 root root 147650 May 22 09:14 /storage/pictures/TV-Bild.jpg I also tried file:///storage... (which should be the right way) but without success. I find it strange that nothing is returned from Kodi. Btw. I use openelec 8.0.3 with Kodi 17.1 RE: Working JSON RPC API Examples - ednt - 2017-05-22 Ups... If I use curl directly: Code: curl smb://user:password@fs2/tv-eingang/TV-Bild.jpg then I get Quote:curl: (1) Protocol "smb" not supported or disabled in libcurl But I still can not load the picture with file:/// RE: Working JSON RPC API Examples - hurlbert - 2017-06-20 (2017-05-22, 11:33)ednt Wrote: Next try: I have no way to verify this but I would suspect this is because internal to Kodi it doesn't know about the mounted drive. RE: Working JSON RPC API Examples - lumiknight - 2017-06-28 (2015-04-27, 04:40)nellie7878 Wrote: Is it possible to submit a library search query through a JSON command? i was wondering this also. it took a lil guess work but i figured out how to do library searches with the json rpc. i wanted to search the library based on title or characters in a title. this is the string im using: {"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "title", "operator": "contains", "value": "sugar"}, "limits": { "start" : 0, "end": 10 }, "properties" : ["rating", "playcount"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"} just change the word "sugar" in my example to anything in a movie title you might be searching for. if you want to find all the movies with "spa" in the title, this will work. at least it is for me. edit: this one will give you the file path to direct play the movie {"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "filter": {"field": "title", "operator": "contains", "value": "sugar"}, "limits": { "start" : 0, "end": 10 }, "properties" : ["mpaa", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"} RE: Working JSON RPC API Examples - lumiknight - 2017-07-07 does anyone know if it is possible to use jsonrpc to direct play the main title of a dvd iso file? so that instead of going to the menu or playing previews it just starts the main movie. RE: Working JSON RPC API Examples - ncarthy - 2017-07-10 (2017-06-20, 18:49)hurlbert Wrote:(2017-05-22, 11:33)ednt Wrote: Next try: It's only a guess but maybe you don't need the "file://" prefix? Code: {"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item":{"file":"/storage/pictures/TV-Bild.jpg"}}} RE: Working JSON RPC API Examples - shiftux - 2017-07-31 hello, just joined the party here. some really cool posts here, thanks for all the work! What I currently struggle with is a solution to do something like "Play the next unseen episode of the show X" Any help or pointers are appreciated! best s. RE: Working JSON RPC API Examples - lumiknight - 2017-08-04 i don't really like asking but i could use an assist, does anyone have a working example of a json string command to pull a list of the audio playlists and there paths so i can direct play it using the json-rpc?? cant seem to get the command to work using the api. thanks in advance. edit: im using the v6 api on jarvis RE: Working JSON RPC API Examples - petou - 2017-08-29 lumiknight: If you created playlist with kodi the playlist should be at /.kodi/userdata/playlists/ (for Linux) see http://kodi.wiki/view/userdata for all OS location. I use this command to play it: (with no shuffle and no repeat) Code: {"jsonrpc":"2.0","id":"1","method":"Player.Open","params":{"item":{"file":"/home/petou/.kodi/userdata/playlists/music/unforgiven.m3u"},"options":{"repeat":"off","shuffled":false}}} might be a good idea to clear current playing list before: Code: {"jsonrpc": "2.0","method": "Playlist.Clear","params":{"playlistid":0}} |