• 1
  • 191
  • 192
  • 193(current)
  • 194
  • 195
  • 226
JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC
Are you serious ? Smile

None of your sample does looks like those in this post.

Either you use a very recent Gotham and the params must looks like

"params": { "showhidewatched": true}

Or use the Player.Open with all params in the URL to bypass the bug.
Reply
Sorry, i tested again in another xbmc version and its working:
Quote:{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params": { "addonid":"script.cavplus","params":["showhidewatched=true"]},"id":1}
Was a stupid mistake mine, i install a script with a different name in the addon.xml.
The other stupid mistake, i forgot to insert the "Key" in the params:
Quote:{"jsonrpc":"2.0","method":"Addons.ExecuteAddon","params": { "addonid":"script.cavplus","params":{"showhidewatched":"true"}},"id":1}
I believe that the code above will work too.
Clayton
Reply
Buy the way Tolriq, i am always serious. I made my request based on the examples on the topic, of course, i put my "codes".
Reply
When retrieving sources with Files.GetSources, is there no way to obtain the "content" type for each source (ie. none, movies, music videos, tvshows)? This would be very useful.
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
Hi
How can i insert several files at once in a Playlist using Playlist.Insert? Can i made a "chain" insert ?
Reply
You can't you can only use batch commands. multiple json commands in a [] Smile

Be aware that the Team have said that in the future batch commands can be treated in any order and so that batch commands may in the future not insert the media in the correct order.

Leaving to no official long living solution but making lots of requests.
Reply
(2013-05-24, 13:03)Tolriq Wrote: You can't you can only use batch commands. multiple json commands in a [] Smile

Be aware that the Team have said that in the future batch commands can be treated in any order and so that batch commands may in the future not insert the media in the correct order.

Leaving to no official long living solution but making lots of requests.

Very thanks Tolriq, i have this similar problem with my interface since i am using javascript. If i try to get all the episodes with a playcount = 0 and then insert in a playlist i will always have a out of order episodes numbers, since all my requests are asynchronous i have to use a setTimeout function, its not a good thing to use. For now i have to use a smartplaylist or a little script that i made.
The best for me to get this working (easily insert non watched episodes in a playlist) is using the script
Quote:def _unWatchedEpisodes(self):
log("playlist insert")
playlist = xbmc.PlayList(1)
playlist.clear()
tvshowid = int(self.UNWATCHEDEPISODES)
json_filter = '"filter":{"field": "playcount", "operator": "is", "value": "0"}'
json_params = '"params": {"sort": {"order": "ascending", "method": "episode"},"properties": ["episode", "season", "playcount","file"], "tvshowid":%s,%s }' % (tvshowid,json_filter)
json_request = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes",%s , "id": 1}'% json_params)
json_request = unicode(json_request, 'utf-8', errors='ignore')
json_response = simplejson.loads(json_request)
if json_response.has_key('result') and json_response['result'] != None and json_response['result'].has_key('episodes'):
for episodesList in json_response['result']['episodes']:
#if episodesList.has_key('playcount'):
playcount = int(episodesList['playcount'])
if playcount==0:
file = episodesList['file']
fileReplace = file.replace("\\","/")
episodeid = int(episodesList['episodeid'])
xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Playlist.Add","params":{"playlistid":1, "item": {"episodeid": %d}}}'%episodeid)
#playlist.add(url=file)
If i use this i can insert all the non watched episodes at once and i will avoid to use another loop in my interface.
Maybe i am missing something and there is another easy way to do this directly in the JSON, i dont see in the Wiki, but maybe i am missing something.
Clayton
Reply
I'm running XBMC Frodo and having an issue trying to kick off playback of music from a m3u playlist using the JSON api.

I've confirmed that my playlist works fine when I start playing it via the GUI. But when I fire the following API call I get shown an empty black screen:

Quote:curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "special://profile/playlists/music/QueensOfTheStoneAge-LikeClockwork.m3u" }}, "id": 1 }' http://localhost:8080/jsonrpc

Here is the output I see from my curl command:

Quote:xbian@xbian ~/.xbmc/userdata/playlists/music $ curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "special://profile/playlists/music/QueensOfTheStoneAge-LikeClockwork.m3u" }}, "id": 1 }' http://localhost:8080/jsonrpc
* About to connect() to localhost port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST /jsonrpc HTTP/1.1
> User-Agent: curl/7.26.0
> Host: localhost:8080
> Accept: application/json
> Content-type: application/json
> Content-Length: 162
>
* upload completely sent off: 162 out of 162 bytes
* additional stuff not fine transfer.c:1037: 0 0
* additional stuff not fine transfer.c:1037: 0 0
* additional stuff not fine transfer.c:1037: 0 0
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Content-Length: 38
< Content-Type: application/json
< Date: Sun, 16 Jun 2013 15:01:25 GMT
<
* Connection #0 to host localhost left intact
{"id":1,"jsonrpc":"2.0","result":"OK"}* Closing connection #0

If I then check what is in the playlist I see that it is empty:

Quote:xbian@xbian ~/.xbmc/userdata/playlists/music $ curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{ "jsonrpc": "2.0", "method": "Playlist.GetItems", "params": { "playlistid": 0 }, "id": 1 }' http://localhost:8080/jsonrpc
* About to connect() to localhost port 8080 (#0)
* Trying 127.0.0.1...
* connected
* Connected to localhost (127.0.0.1) port 8080 (#0)
> POST /jsonrpc HTTP/1.1
> User-Agent: curl/7.26.0
> Host: localhost:8080
> Accept: application/json
> Content-type: application/json
> Content-Length: 91
>
* upload completely sent off: 91 out of 91 bytes
* additional stuff not fine transfer.c:1037: 0 0
* HTTP 1.1 or later with persistent connection, pipelining supported
< HTTP/1.1 200 OK
< Content-Length: 74
< Content-Type: application/json
< Date: Sun, 16 Jun 2013 15:01:35 GMT
<
* Connection #0 to host localhost left intact
{"id":1,"jsonrpc":"2.0","result":{"limits":{"end":0,"start":0,"total":0}}}* Closing connection #0

If I make a smart playlist which contains the following:

Quote:<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="albums">
<name>QueensOfTheStoneAge-LikeClockwork</name>
<match>all</match>
<rule field="artist" operator="contains">
<value>Queens of the Stone Age</value>
</rule>
<rule field="year" operator="is">
<value>2013</value>
</rule>
</smartplaylist>

And launch it in the same way:

Quote:curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d '{ "jsonrpc": "2.0", "method": "Player.Open", "params": { "item": { "file": "special://profile/playlists/music/QueensOfTheStoneAge-LikeClockwork.xsp" }}, "id": 1 }' http://localhost:8080/jsonrpc

Everything works as expected. The album playsback and I can see in the playlist:

Quote:{"id":1,"jsonrpc":"2.0","result":{"items":[{"id":7327,"label":"Keep Your Eyes Peeled","type":"song"},{"id":7328,"label":"I Sat By The Ocean","type":"song"},{"id":7329,"label":"The Vampyre Of Time And Memory","type":"song"},{"id":7330,"label":"If I Had A Tail","type":"song"},{"id":7331,"label":"My God Is The Sun","type":"song"},{"id":7332,"label":"Kalopsia","type":"song"},{"id":7333,"label":"Fairweather Friends","type":"song"},{"id":7334,"label":"Smooth Sailing","type":"song"},{"id":7335,"label":"I Appear Missing","type":"song"},{"id":7336,"label":"…Like Clockwork","type":"song"}],"limits":{"end":10,"start":0,"total":10}}}

My guess is that firing a Player.Open containing a m3u file is actually kicking off an image playback, rather than music playback. I base this on the output I see in my xbmc.log file:

Quote:08:08:12 T:3042213888 DEBUG: We have an error loading a picture!
08:08:12 T:3042213888 ERROR: CGUIWindowSlideShow::RenderErrorMessage - cant get label control!

For now I guess I am going to have to fix up all the tags in my albums and use smartplaylists. I wanted to avoid this as it is far easier for me to programatically generate m3u files.
Reply
Well known still unresolved don't know why problem Smile

m3u are associated by default with pictures, simple solution :

You just need to add the following in your advanced settings in Xbmc installation
<pictureextensions>
<remove>.m3u</remove>
</pictureextensions>
Reply
(2013-06-16, 17:12)Tolriq Wrote: Well known still unresolved don't know why problem Smile

m3u are associated by default with pictures, simple solution :

You just need to add the following in your advanced settings in Xbmc installation
<pictureextensions>
<remove>.m3u</remove>
</pictureextensions>

Thanks! It is always so awesome when it is a 4 line fix for something you've been banging around head against a wall for a few days over.

My searching for a solution here on the forums was difficult because I couldn't just search for m3u (too short!).
Reply
I'm now having trouble trying to get my m3u playlists to be shuffled.

I have tried both:

Code:
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d "{ \"jsonrpc\": \"2.0\", \"method\": \"Player.Open\", \"params\": { \"item\": { \"file\": \"special://profile/playlists/music/NiN.m3u\" }, \"options\": {\"shuffled\": true}}, \"id\": 1 }" http://192.168.0.16:8080/jsonrpc

And, after kicking off playback of a playlist I've tried:

Code:
curl -v -H "Accept: application/json" -H "Content-type: application/json" -X POST -d "{ \"jsonrpc\": \"2.0\", \"method\": \"Player.SetShuffle\", \"params\": { \"playerid\": 0, \"shuffle\": true}, \"id\": 1 }" http://192.168.0.16:8080/jsonrpc

Both of these give me responses which make me think they've worked:

Code:
{"id":1,"jsonrpc":"2.0","result":"OK"}* Closing connection #0

But there is no shufflage going on.

Any tips as to what I'm doing wrong?
Reply
This is strange behavior of Xbmc but opening an m3u is seen in xbmc as a single file and not multiple ones added to a playlist.

So there's no way to shuffle it.

This make me think that i saw a pr that changed the next / previous behavior should be tested in this situation.
Reply
(2013-06-23, 22:40)Tolriq Wrote: This is strange behavior of Xbmc but opening an m3u is seen in xbmc as a single file and not multiple ones added to a playlist.

So there's no way to shuffle it.

This make me think that i saw a pr that changed the next / previous behavior should be tested in this situation.

Bummer. Thanks for the info. I guess for now I'll whip up bash script which shuffles the lines in the file before I pass it off to xbmc.
Reply
Well if you go with script you should perhaps just read the m3u and add files to Xbmc playlist, this would allow much better control after since all files would be in the playlist.
Reply
It seems I can get a loaded playlist to shuffle. Here are the api commands I used.

Code:
{"jsonrpc":"2.0","method":"Playlist.Add","params":{"playlistid":0,"item":{"directory":"special://profile/playlists/music/doo.m3u"}},"id":1}

and

Code:
{"jsonrpc":"2.0","method":"Player.SetShuffle","params":{"playerid":0,"shuffle":true},"id":1}

The biggest difference I can see is using Playlist.Add instead of Player.Open.

Hope this helps.
I am an expert at acting like an expert ---- WC Fields.

XBMC Web Control Interface - https://github.com/mthiels/webinterface.xrc
Reply
  • 1
  • 191
  • 192
  • 193(current)
  • 194
  • 195
  • 226

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