summaryrefslogtreecommitdiff
path: root/apps/playlist_catalog.c
diff options
context:
space:
mode:
authorChristian Soffke <christian.soffke@gmail.com>2022-08-16 13:10:13 +0200
committerChristian Soffke <christian.soffke@gmail.com>2023-01-14 12:14:28 -0500
commit7f265ee8dd062a015e214b16f9c41fc27e867f22 (patch)
tree87ba5da95ef7870c922fd7206640c976ad72794a /apps/playlist_catalog.c
parentcc79f1b543535e8d7e5b9875af9043c16267e429 (diff)
downloadrockbox-7f265ee8dd062a015e214b16f9c41fc27e867f22.tar.gz
rockbox-7f265ee8dd062a015e214b16f9c41fc27e867f22.zip
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
Diffstat (limited to 'apps/playlist_catalog.c')
-rw-r--r--apps/playlist_catalog.c16
1 files changed, 12 insertions, 4 deletions
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)
389 return (display_playlists(NULL, CATBROWSE_CATVIEW) >= 0); 389 return (display_playlists(NULL, CATBROWSE_CATVIEW) >= 0);
390} 390}
391 391
392static int (*ctx_add_to_playlist)(const char* playlist, bool new_playlist);
392bool catalog_add_to_a_playlist(const char* sel, int sel_attr, 393bool catalog_add_to_a_playlist(const char* sel, int sel_attr,
393 bool new_playlist, char *m3u8name) 394 bool new_playlist, char *m3u8name,
395 void (*add_to_pl_cb))
394{ 396{
397 int result;
395 char playlist[MAX_PATH + 7]; /* room for /.m3u8\0*/ 398 char playlist[MAX_PATH + 7]; /* room for /.m3u8\0*/
396 if ((browser_status & CATBROWSE_PLAYLIST) == CATBROWSE_PLAYLIST) 399 if ((browser_status & CATBROWSE_PLAYLIST) == CATBROWSE_PLAYLIST)
397 return false; 400 return false;
@@ -437,8 +440,13 @@ bool catalog_add_to_a_playlist(const char* sel, int sel_attr,
437 return false; 440 return false;
438 } 441 }
439 442
440 if (add_to_playlist(playlist, new_playlist, sel, sel_attr) == 0) 443 if (add_to_pl_cb != NULL)
441 return true; 444 {
445 ctx_add_to_playlist = add_to_pl_cb;
446 result = ctx_add_to_playlist(playlist, new_playlist);
447 }
442 else 448 else
443 return false; 449 result = add_to_playlist(playlist, new_playlist, sel, sel_attr);
450
451 return (result == 0);
444} 452}