Help - Search - Members - Calendar
Full Version: Persistent playlist locks
Hydrogenaudio Forums > Hosted Forums > foobar2000 > Development - (fb2k)
FrozenSpoon
I'd like to create a playlist lock that's persistent across foobar sessions. The obvious way of doing this is to remember the index the lock is on at exit, and then restore the lock at init.
There are ways of that breaking though. For example, someone could uninstall the plguin for several sessions, change their playlists, and reinstall the plugin. Now the stored index is stale and may get installed on the wrong playlist.

Anyone have good ideas how to accomplish this more cleanly?
foosion
You can additionally store the playlist name to add a little safety. There is a clean solution, but it requires the 0.9.5 SDK to be released first.
foosion
Here is what you can do in 0.9.5.2:
  • If you want to create an autplaylist, there are now Autoplaylist APIs to help you with that.
  • Another way is to associate persistent data with a playlist is to use a playlist property and scan the existing playlists in initquit::on_init(). See playlist_manager_v2.
mixcherry
Hi! Would you be so kind to give some more hints on how to use playlist_manager_v2? What is the difference between playlist_set_property and playlist_set_runtime_property (and what exactly should be its third parameter)?
E.g. now I'm 'binding' some string data to playlist using such code:
CODE
pfc::array_t<unsigned char> temp("Testing");
static_api_ptr_t<playlist_manager_v2>()->playlist_set_property(0, guid_cfg_test, temp);

Could I, somehow, set property to some arbitrary data type (class, struct) as long as it's serializable?
foosion
QUOTE(mixcherry @ Apr 30 2008, 12:10) *
What is the difference between playlist_set_property and playlist_set_runtime_property (and what exactly should be its third parameter)?
I have updated the documentation of playlist_manager_v2 in my online version, which should answer this question.
QUOTE(mixcherry @ Apr 30 2008, 12:10) *
Could I, somehow, set property to some arbitrary data type (class, struct) as long as it's serializable?
Pretty much yes. Note that runtime properties are different and use service pointers, which are used here only as reference counted data.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.