Kodi Community Forum

Full Version: Retain queue (playlist) state between runs
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
As discussed here: https://forum.kodi.tv/showthread.php?tid...id=2958335

It's fairly standard for music players to retain queue state between runs, Kodi doesn't and it would rock if it did or could.

Currently any time Kodi is restarted or the PC is restarted, Kodi starts with an empty queue.

It would be awesome if it would/could start with the queue as it was.

This involves maintaining persistent queue state in a disk file or database, updating it on queue changes and loading it when starting.
This is something I've wanted for a long time, including saving the last played item so playback could resume in a later session.  My thoughts were maybe an addon could run as a service and store a playlist and use the monitor function to update the currently playing item.  But of course if it could be done in core that would be better.  My use case is at Christmas I like to be able to play through my entire library of Christmas albums during the season.  Same thing with movie soundtrack/OST albums.   I prefer doing an album at a time without repeats so party mode doesn't work for me.  (For example many albums are classical and randomly playing tracks from a classical work makes no sense.)  My current practice is to use a smart playlist of albums set to random order, which meets my first requirement but not my second.

scott s.
.
FYI easy to accomplish this via python script
(2020-06-19, 21:55)Lunatixz Wrote: [ -> ]FYI easy to accomplish this via python script

That's awesome news. But:
  1. I'd still be keen to see it as a core feature, as I believe it's a true value add to Kodi, not some idiosynchratic personal feature (which is what I use scripts for).

  2. In the mean time I'd love to write the script but am fairly green (and so it's costly in research and experimentation) so if you think it easy, could you maybe either provide some key pointers or write one? For example:
    1. I'd need a hook into Queue changes (so a function runs every time the queue changes, has something added to it or removed or moved around)
    2. A hook into playing track changes (so a function runs whenever a new track starts playing)
    3. A hook into the bootstrap (so a function can run when Kodi starts)
    4. A kodi-canonical persistent store, as in what is the norm in kodi? Write the state out to a file in ~/.kodi, or does kodi offer a database to which a table can be added to capture queue state?
Those all demand considerable research and proof of concept testing before I'd have something running and that sets me up for failure (being distracted and onto another project before it's don ;-).  That said, much of the doc on kodi scripting is pretty good and helpful. I'm really just speaking to your observation that it's pretty easy, where from my perspective it looks like a job that could consume a few evenings of mine. But as stated, I'd enjoy a script so I have the feature now, but I still feel it's an important value add to the kodi core code base, because it's just the norm for music players and Kodi makes a great jukebox bar a few little rough edges like this.
(2020-06-19, 21:55)Lunatixz Wrote: [ -> ]FYI easy to accomplish this via python script

And it seems it's been done as an add on:

https://github.com/drax68/kodi-resume

Fantastic! That's a great start. Though again, this really belongs in the Kodi core.