core/playlist: Add playlist_update() function
Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
parent
5a0fc355e4
commit
1527ee0e6d
|
@ -61,6 +61,11 @@ bool playlist_remove(enum playlist_t plist, struct track *track)
|
|||
return pl_system.pl_remove_track(playlist_names[plist], track);
|
||||
}
|
||||
|
||||
void playlist_update(enum playlist_t plist)
|
||||
{
|
||||
pl_system.pl_update(playlist_names[plist]);
|
||||
}
|
||||
|
||||
bool playlist_has(enum playlist_t plist, struct track *track)
|
||||
{
|
||||
struct queue *queue = pl_system.pl_get_queue(playlist_names[plist]);
|
||||
|
|
|
@ -79,11 +79,17 @@ static bool pl_system_remove_track(const gchar *name, struct track *track)
|
|||
return true;
|
||||
}
|
||||
|
||||
static void pl_system_update(const gchar *name)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
struct playlist_type pl_system = {
|
||||
.pl_get_queue = pl_system_get_queue,
|
||||
.pl_add_track = pl_system_add_track,
|
||||
.pl_remove_track = pl_system_remove_track,
|
||||
.pl_update = pl_system_update,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -33,6 +33,9 @@ bool playlist_add(enum playlist_t, struct track *);
|
|||
/* Called to remove a track from a playlist. */
|
||||
bool playlist_remove(enum playlist_t, struct track *);
|
||||
|
||||
/* Called to update tracks on a playlist. */
|
||||
void playlist_update(enum playlist_t);
|
||||
|
||||
|
||||
/* Called to check if a specific track is in the playlist. */
|
||||
bool playlist_has(enum playlist_t, struct track *);
|
||||
|
|
|
@ -18,6 +18,9 @@ struct playlist_type {
|
|||
|
||||
/* Called to remove a track from the playlist. */
|
||||
bool (*pl_remove_track)(const gchar *, struct track *);
|
||||
|
||||
/* Called to update a playlist. */
|
||||
void (*pl_update)(const gchar *);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -27,6 +27,12 @@
|
|||
test_equal(pl_system.pl_remove_track(name, track_get(1)), (bool)false); \
|
||||
__test_playlist_state(queue, 0, false, false)
|
||||
|
||||
#define __test_playlist_update(name, queue, ex_size, ex_track0, ex_track1) \
|
||||
pl_system.pl_update(name); \
|
||||
while (idle_run_task()) {}; \
|
||||
__test_playlist_state(queue, ex_size, ex_track0, ex_track1)
|
||||
|
||||
|
||||
#define __test_playlist_reinit(queue, ex_size, ex_track0, ex_track1) \
|
||||
pl_system_deinit(); \
|
||||
pl_system_init(NULL); \
|
||||
|
@ -70,6 +76,7 @@ static void test_favorites()
|
|||
|
||||
__test_playlist_add("Favorites", queue);
|
||||
__test_playlist_reinit(queue, 2, true, true);
|
||||
__test_playlist_update("Favorites", queue, 2, true, true);
|
||||
__test_playlist_remove("Favorites", queue);
|
||||
}
|
||||
|
||||
|
@ -82,6 +89,7 @@ static void test_hidden()
|
|||
|
||||
__test_playlist_add("Hidden", queue);
|
||||
__test_playlist_reinit(queue, 2, true, true);
|
||||
__test_playlist_update("Hidden", queue, 2, true, true);
|
||||
__test_playlist_remove("Hidden", queue);
|
||||
|
||||
pl_system_deinit();
|
||||
|
|
Loading…
Reference in New Issue