From 7f265ee8dd062a015e214b16f9c41fc27e867f22 Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Tue, 16 Aug 2022 13:10:13 +0200 Subject: Database: Add ability to insert multiple files into playlists You could only add single files to playlists from the database browser before. This enables adding any database selection to a new or existing playlist. Change-Id: I811c7167641c589944bb2afc18dcc1d299a7b979 --- apps/playlist_catalog.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'apps/playlist_catalog.c') diff --git a/apps/playlist_catalog.c b/apps/playlist_catalog.c index c3cbc93a20..b6939208ac 100644 --- a/apps/playlist_catalog.c +++ b/apps/playlist_catalog.c @@ -389,9 +389,12 @@ bool catalog_view_playlists(void) return (display_playlists(NULL, CATBROWSE_CATVIEW) >= 0); } +static int (*ctx_add_to_playlist)(const char* playlist, bool new_playlist); bool catalog_add_to_a_playlist(const char* sel, int sel_attr, - bool new_playlist, char *m3u8name) + bool new_playlist, char *m3u8name, + void (*add_to_pl_cb)) { + int result; char playlist[MAX_PATH + 7]; /* room for /.m3u8\0*/ if ((browser_status & CATBROWSE_PLAYLIST) == CATBROWSE_PLAYLIST) return false; @@ -437,8 +440,13 @@ bool catalog_add_to_a_playlist(const char* sel, int sel_attr, return false; } - if (add_to_playlist(playlist, new_playlist, sel, sel_attr) == 0) - return true; + if (add_to_pl_cb != NULL) + { + ctx_add_to_playlist = add_to_pl_cb; + result = ctx_add_to_playlist(playlist, new_playlist); + } else - return false; + result = add_to_playlist(playlist, new_playlist, sel, sel_attr); + + return (result == 0); } -- cgit v1.2.3