HydrogenAudio

Hosted Forums => foobar2000 => Development - (fb2k) => Topic started by: steel_space on 2003-05-21 16:37:39

Title: SDK - playlist
Post by: steel_space on 2003-05-21 16:37:39
is there a way, how to get callback to playlist events? I mean to catch adding/removing items to/from the currently displayed playlist?
Title: SDK - playlist
Post by: kode54 on 2003-05-22 02:26:41
I think playlist_loader_callback is what you need, see playlist_loader.h.
Title: SDK - playlist
Post by: steel_space on 2003-05-22 07:16:04
Quote
I think playlist_loader_callback is what you need, see playlist_loader.h.

playlist_loader_callback does NOT inherit from service_base, so I can't use it like this:
static service_factory_single_t< playlist_loader_callback, playlist_loader_callback_ui > foo_playlist_loader_callback ;

is there a different way?
Title: SDK - playlist
Post by: kode54 on 2003-05-22 10:46:46
Whoops, I guess CG was right.
Title: SDK - playlist
Post by: steel_space on 2003-05-27 09:36:19
will you implement it in the new version?
Title: SDK - playlist
Post by: kode54 on 2003-05-27 17:26:34
Why exactly do you need it?
Title: SDK - playlist
Post by: Curi0us_George on 2003-05-28 03:25:03
It has a lot of purposes.  Want to build a completely different interface?  You'll need it.  Want to change shuffle behavior?  You might need it.
Title: SDK - playlist
Post by: kode54 on 2003-05-28 04:14:33
Oops, forgot about that.
Title: SDK - playlist
Post by: steel_space on 2003-05-28 07:11:00
thaht's right - I make foo_remote plug-in and I want to display playlist in own window
Title: SDK - playlist
Post by: zanson on 2003-05-28 19:38:03
Why do people want to make playlist windows?  The main foobar window is a playlist.  I can understand wanting a small window for controlling playback and showing the currently playing song, i use foo_wsgui and foo_uftS, but don't really see why people want to make their own playlist windows.
Title: SDK - playlist
Post by: Curi0us_George on 2003-05-28 19:57:10
Well, Peter obviously does.  He plans to fully separate the GUI from the core in some future version.
Title: SDK - playlist
Post by: danZ on 2003-05-30 22:06:26
Quote
Well, Peter obviously does.  He plans to fully separate the GUI from the core in some future version.

I agree, if Peter used the SDK more directly to do his playlist window we'd all be better off since he'd be forced to implement all the things we'd probably ever need.

For example, I'd like to extend the play_callback interface to include callbacks for toggling repeat, shuffle, and other things that are a little hard to keep in sync with the foobar main window.

Callbacks for playlist operations would prob. be nice too

and so on...
Title: SDK - playlist
Post by: steel_space on 2003-06-18 07:13:33
So gentlemen,
what is the resume - will anybody implement this feature?
Title: SDK - playlist
Post by: Curi0us_George on 2003-06-18 10:43:42
I'm pretty sure that something like this is going to be in the 0.7 SDK.
Title: SDK - playlist
Post by: danZ on 2003-06-18 16:26:01
class NOVTABLE metadb_callback : public service_base//use service_factory_single_t to instantiate, you will get called with database notifications
{
public:
   virtual void on_info_edited(metadb_handle * handle) {}
   virtual void on_info_reloaded(metadb_handle * handle) {}
   virtual void on_file_removed(metadb_handle * handle) {}
   virtual void on_file_moved(metadb_handle * src,metadb_handle * dst) {}
   virtual void on_file_new(metadb_handle * handle) {}//reserved for future use
   virtual void on_file_removed_user(metadb_handle * handle) {}//user requested file to be removed from db, file didn't get physically removed
//warning: all callback methods are called inside database_lock section ! watch out for deadlock conditions if you use SendMessage() or critical sections
   static GUID get_class_guid()
   {
      // {D5286BB4-FDED-47ef-A623-4C3FF056DEC1}
      static const GUID guid =
      { 0xd5286bb4, 0xfded, 0x47ef, { 0xa6, 0x23, 0x4c, 0x3f, 0xf0, 0x56, 0xde, 0xc1 } };
      return guid;
   }
};


Is that what you are looking for?

You should be able to traverse the playlist and build your own list.  This call back *should* allow you to keep your playlist in sync with the foobar playlist.
Title: SDK - playlist
Post by: Curi0us_George on 2003-06-18 17:43:48
erm, the playlist is not the database
Title: SDK - playlist
Post by: danZ on 2003-06-18 19:51:21
Quote
erm, the playlist is not the database

I thought he wanted the playlist?


Quote
is there a way, how to get callback to playlist events? I mean to catch adding/removing items to/from the currently displayed playlist?


Maybe I missed something later in the thread.
Title: SDK - playlist
Post by: Curi0us_George on 2003-06-18 20:00:43
Yes, he wanted playlist.  And you posted the database callback.
Title: SDK - playlist
Post by: danZ on 2003-06-18 21:07:27
Quote
Yes, he wanted playlist.  And you posted the database callback.

Ah, OK, my bad.

I used to above to detect when the old inet_reader updated the song title with the new metadata (which updates the the foobar playlist).  I didn't see the database/playlist distinction.

Thanks.