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.