Solved Saving a playlist
#1
Hello everybody,

I'm facing an odd problem: I create a playlist that contain all music files there is in my AudioLibrary with a script and I want to save it.
I've seen that it's not possible to directly save a playlist, so I want to create a pls file.
But to do that I nedd to get back file paths from the AudioLibrary.

And when I do that:
Code:
{"jsonrpc": "2.0", "method": "AudioLibrary.GetSongs", "properties": ["title","artist","albumartist","genre","year","rating","album","track","duration","comment","lyrics","musicbrainztrackid","musicbrainzartistid","musicbrainzalbumid","musicbrainzalbumartistid","playcount","fanart","thumbnail","file","artistid","albumid"], "sort": { "order": "ascending", "method": "track", "ignorearticle": true }, "id": 1}

I get that kind of answers:
Code:
{u'songid': 19, u'label': u'Track 07'}
{u'songid': 20, u'label': u'Track 14'}
{u'songid': 21, u'label': u'Track 15'}

It seems that lots of the request fields are missing...

Is there an other way to save a playlist? I can't create it at each startup: it's too long (thousands of files to be added) !
Reply
#2
Why don't you just create a smart playlist (wiki) so you don't have to create/maintain a list of every music file you wish to play?
Reply
#3
(2013-09-06, 16:00)artrafael Wrote: Why don't you just create a smart playlist (wiki) so you don't have to create/maintain a list of every music file you wish to play?

Hi,

It sounds interresting.

If I well understand the documentation, my file should look like that:
Code:
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<smartplaylist type="songs">
    <name>Full playlist</name>
    <match>all</match>
</smartplaylist>

Can I save this file in my addon main folder or is it mandatory to save it in Users/AppData/Roaming/XBMC/userdata/Playlists ?

I've implemented a "resume" feature: at XBMC startup it start playing the same song before XBMC was closed.
Can I still use the Player.Open and Player.GoTo with a smart playlist?
Reply
#4
Hi,

Thank you very much, artrafael !
It works better than I expected.

But it doesn't solve the problem of saving programatically created playlist Wink.
Reply
#5
In your first post, you said you want to build a playlist that contains all your songs in your audio library and the smart playlist can easily do that without the need to add the locations/names of each song file from your library, either manually or programatically. Now it sounds like you want to do something else with a programatically created playlist? What is the purpose of this playlist? How is it created? What criteria are you using to select which songs get included in the playlist if it's not all songs as stated in your first post?
Reply
#6
Well,

My first objective was to load a playlist that contains all song files I have in my library.
The smart playlist works pretty well for that.

But I'm still curious on how the XBMC core creates playlist files: I can't find any function to save a playlist, so I think the core creates m3u files by directly writing filenames in the file. That makes me find a bug in the AudioLibrary.GetSongs JSON function: I can't retrieve filenames, even if I ask for. My JSON query may be false, but I don't think so, any other arguments except a few) are present in the answer to my query.

So I'm just curious...
Reply

Logout Mark Read Team Forum Stats Members Help
Saving a playlist0