Kodi Community Forum

Full Version: Play a playlist like with HTTP API: PlayFile(filename;[playlist])
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

With Eden, i could play my playlist (xsp file) with the command PlayFile(filename;[playlist]) throught HTTP API.

Since i updated eden to frodo, i can't do that anymore.

On the wiki i rode this:

"THIS API IS DEPRECATED

As of the Dharma release of XBMC, this API is deprecated.
As of the Frodo release of XBMC, this API is no longer available.
Use the JSON RPC interface instead. "

Ok, so i have to use Json RPC interface but which is the command to play a playlist like i did before ?

Thanks
Player.Open using the "file" property in the "item" parameter.
Hi,

I tried that but it doesn't work.

I'm using JSON command from eventghost xbmc plugin, so i don't know if it is an issue with xbmc or eventghost...

I put the complete location to the file, is it the good use ? :

C:\Documents and settings\user\application data.......file.xsp
Is .xsp the only playlist type supported? as I tried .m3u and XBMC tried to show it as pictures.

edit: @nonob I made a post with a working command in the EventGhost forum.

jonib
It works, thanks a lot Smile

Here is the link to eventghost forum:

http://www.eventghost.net/forum/viewtopi...987#p25987
The problem with .m3u playlists is not with JSON-RPC but with the file extensions registered for each media type. See http://trac.xbmc.org/ticket/14124 for an explanation and a workaround.
(2013-03-05, 17:24)Montellese Wrote: [ -> ]The problem with .m3u playlists is not with JSON-RPC but with the file extensions registered for each media type. See http://trac.xbmc.org/ticket/14124 for an explanation and a workaround.
Thanks for the info. Hmm, just my luck that I had to test the one(?) playlist type that wouldn't work. Confused

And I have to agree with the comment on the ticket about why .m3u is associated with pictures. As far as I know .m3u is mostly for music/audio and Wikipedia seems to agree M3U on Wiki. All examples are .mp3s.

jonib
Here is another workaround without touching advancedsettings.xml

Add the m3u file as a directory to the queue and start playback

Code:
curl  -H "Content-Type: application/json"  -d "{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"Playlist.Add\",\"params\":{\"item\":{\"directory\":\"special://profile/playlists/music/test3.m3u\"},\"playlistid\":0}}" http://xbmc:8080/jsonrpc

curl  -H "Content-Type: application/json"  -d "{\"jsonrpc\": \"2.0\", \"method\": \"Player.Open\", \"params\": { \"item\": { \"playlistid\": 0, \"position\": 0 } }, \"id\": 1}" http://xbmc:8080/jsonrpc

You may want to execute Playlist.Clear before to remove previous content.

Or sending the two requests in a batch
Code:
curl  -H "Content-Type: application/json"  -d "[{\"id\":1,\"jsonrpc\":\"2.0\",\"method\":\"Playlist.Add\",\"params\":{\"item\":{\"directory\":\"special://profile/playlists/music/test3.m3u\"},\"playlistid\":0}},{\"jsonrpc\": \"2.0\", \"method\": \"Player.Open\", \"params\": { \"item\": { \"playlistid\": 0, \"position\": 0 } }, \"id\": 1}]" http://xbmc:8080/jsonrpc
The only drawback of doing it this way is that the items details are not pre fetched Sad

I you play the .m3u Xbmc does load all items details, if you add a directory Xbmc only load the current and the next items details, leaving all the rest of the playlist with the just item path until it reach them.

Don't know if there's a way to force the item details fetching.
@Tolriq: The xbmc gui shows the proper name for me but I thing you where talking about Player.GetItem.

If I query the queue with Player.GetItem I get the proper metadata back as long as the file has been scanned to the library before otherwise as you said it only returns the path.

It's probably due to the same issue as we found for queuing items from plugins where the metadata was missing. There's probably not much you can do to refresh this data without modifying xbmc.