Working JSON RPC API Examples

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
t4_ravenbird Offline
Senior Member
Posts: 276
Joined: Mar 2012
Reputation: 11
Post: #121
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" }
{ "properties": { "directory":"home" , "media":"video" } }

this is a nice place to check your syntax : http://www.jsoneditoronline.org/
find quote
lumiknight Offline
Junior Member
Posts: 5
Joined: Mar 2017
Reputation: 0
Post: #122
Huh 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
find quote
NeoNator Offline
Junior Member
Posts: 9
Joined: Apr 2017
Reputation: 0
Post: #123
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 Tongue

( {"jsonrpc":"2.0","method":"Player.Seek","params":{ "playerid":1,"value":"smallforward"},"id":1} )
find quote
wrinkols Offline
Junior Member
Posts: 2
Joined: May 2017
Reputation: 0
Post: #124
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
(This post was last modified: 2017-05-10 17:39 by wrinkols.)
find quote
wrinkols Offline
Junior Member
Posts: 2
Joined: May 2017
Reputation: 0
Post: #125
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
(This post was last modified: 2017-05-20 18:20 by wrinkols.)
find quote
ednt Offline
Junior Member
Posts: 3
Joined: May 2017
Reputation: 0
Post: #126
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:[email protected]/tv-eingang/TV-Bild.jpg"}}}
But get no response from Kodi.

If I use this:
Code:
{"jsonrpc":"2.0","id":1,"method":"Player.Open","params":{"item":{"file":"'smb://user:[email protected]/tv-eingang/TV-Bild.jpg'"}}}
(additional single quotes around, saw this somewhere in github)
I get:
Code:
{"id":1,"jsonrpc":"2.0","result":"OK"}
But still no picture shown.

Any ideas?

Thanks in advance
(This post was last modified: 2017-05-22 11:56 by ednt.)
find quote
ednt Offline
Junior Member
Posts: 3
Joined: May 2017
Reputation: 0
Post: #127
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
(This post was last modified: 2017-05-22 16:39 by ednt.)
find quote
ednt Offline
Junior Member
Posts: 3
Joined: May 2017
Reputation: 0
Post: #128
Ups...

If I use curl directly:
Code:
curl smb://user:[email protected]/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:///
find quote
Post Reply