Kodi Community Forum

Full Version: Loading Playlist Files
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello All,

I am trying to load various playlist files - mostly .m3u and .wpl files. What I want to do is load them, and then be able to query using "Playlist.GetItems" and return the individual songs in the playlist. However, when I do this, I only get the title of the playlist returned. Here is my sequence of commands:

Code:
{"jsonrpc": "2.0",  "method": "Playlist.Add","params":{"playlistid":0,"item":{"file":"file://C:/Documents and Settings/Smith/Desktop/Playlist.m3u"}},"id":789}

This successfully loads the playlist. I then call "Player.GetItems" in an attempt to return the songs in this playlist:

Code:
{"jsonrpc":"2.0", "id":789, "method":"Playlist.GetItems","params":{"playlistid":0,"properties":["title"]}}

The response is as follows:

Code:
{"id":789,"jsonrpc":"2.0","result":{"items":[{"label":"Playlist.m3u","title":"","type":"unknown"}],"limits":{"end":1,"start":0,"total":1}}}

This is useless to me. What I need to know is the names of the songs inside this playlist. Is there a way to access that?

Another thing that is weird is that if I use "Player.Open" to call the playlist, I can call "Playlist.GetItems" and it does return track names, but interestingly enough, only under playlistid=1, even when dealing with audio.

Is it possible to return a list of items in a playlist?
(2013-12-14, 00:58)chickenwing Wrote: [ -> ]Hello All,

I am trying to load various playlist files - mostly .m3u and .wpl files. What I want to do is load them, and then be able to query using "Playlist.GetItems" and return the individual songs in the playlist. However, when I do this, I only get the title of the playlist returned. Here is my sequence of commands:

Code:
{"jsonrpc": "2.0",  "method": "Playlist.Add","params":{"playlistid":0,"item":{"file":"file://C:/Documents and Settings/Smith/Desktop/Playlist.m3u"}},"id":789}
With that you add the m3u playlist as a single item to the playlist. It doesn't expand the items until you start playing the playlist.

(2013-12-14, 00:58)chickenwing Wrote: [ -> ]This successfully loads the playlist. I then call "Player.GetItems" in an attempt to return the songs in this playlist:

Code:
{"jsonrpc":"2.0", "id":789, "method":"Playlist.GetItems","params":{"playlistid":0,"properties":["title"]}}

The response is as follows:

Code:
{"id":789,"jsonrpc":"2.0","result":{"items":[{"label":"Playlist.m3u","title":"","type":"unknown"}],"limits":{"end":1,"start":0,"total":1}}}

This is useless to me. What I need to know is the names of the songs inside this playlist. Is there a way to access that?
I never tried it myself but maybe Files.GetDirectory works. If not the only way is to start playling the playlist, stop playback and use Playlist.GetItems.

(2013-12-14, 00:58)chickenwing Wrote: [ -> ]Another thing that is weird is that if I use "Player.Open" to call the playlist, I can call "Playlist.GetItems" and it does return track names, but interestingly enough, only under playlistid=1, even when dealing with audio.
That's probably because m3u is also registered as an extension for video playlists and XBMC doesn't know from the m3u file itself whether it's a video or music playlist.
Hi chickenwing,
try:
"directory":"file://C:/Documents and Settings/Smith/Desktop/Playlist.m3u"

instead of
"file":"file://C:/Documents and Settings/Smith/Desktop/Playlist.m3u"

going now looking for some Barbecue sauce... Wink
Markus