core/playlist: Remove playlist_update()
This was only used by system playlists to keep the unplayed, most played, and least played playlist up to date. We can handle this internally through the playlist_played() handler. Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
a33decf549
commit
0754f10883
|
@ -180,11 +180,6 @@ bool playlist_remove(struct playlist *playlist, struct track *track)
|
|||
return ret;
|
||||
}
|
||||
|
||||
void playlist_update(enum playlist_type_t type, const gchar *name)
|
||||
{
|
||||
playlist_types[type]->pl_update(name);
|
||||
}
|
||||
|
||||
bool playlist_has(struct playlist *playlist, struct track *track)
|
||||
{
|
||||
if (!playlist || !track)
|
||||
|
|
|
@ -122,17 +122,12 @@ static void pl_artist_played(struct track *track)
|
|||
queue_updated(&playlist->pl_queue, track);
|
||||
}
|
||||
|
||||
static void pl_artist_update(const gchar *name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
struct playlist_type pl_artist = {
|
||||
.pl_save = pl_artist_save,
|
||||
.pl_lookup = pl_artist_lookup,
|
||||
.pl_get = pl_artist_get,
|
||||
.pl_played = pl_artist_played,
|
||||
.pl_update = pl_artist_update,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -253,13 +253,6 @@ static void pl_library_played(struct track *track)
|
|||
queue_updated(&playlist->pl_queue, track);
|
||||
}
|
||||
|
||||
static void pl_library_update(const gchar *name)
|
||||
{
|
||||
struct playlist *playlist = __lib_pl_lookup(name);
|
||||
if (playlist)
|
||||
idle_schedule(IDLE_SYNC, __lib_pl_update, playlist);
|
||||
}
|
||||
|
||||
|
||||
struct playlist_type pl_library = {
|
||||
.pl_save = pl_library_save,
|
||||
|
@ -267,7 +260,6 @@ struct playlist_type pl_library = {
|
|||
.pl_get = pl_library_get,
|
||||
.pl_new = pl_library_new,
|
||||
.pl_played = pl_library_played,
|
||||
.pl_update = pl_library_update,
|
||||
};
|
||||
|
||||
|
||||
|
@ -282,8 +274,8 @@ void pl_library_init(struct queue_ops *ops)
|
|||
playlist = __lib_pl_alloc(LIBRARY(dbe));
|
||||
LIBRARY(dbe)->li_playlist = playlist;
|
||||
|
||||
idle_schedule(IDLE_SYNC, __lib_pl_add, playlist);
|
||||
pl_library_update(playlist->pl_name);
|
||||
idle_schedule(IDLE_SYNC, __lib_pl_add, playlist);
|
||||
idle_schedule(IDLE_SYNC, __lib_pl_update, playlist);
|
||||
}
|
||||
|
||||
idle_schedule(IDLE_SYNC, __lib_pl_load, NULL);
|
||||
|
@ -301,3 +293,8 @@ void pl_library_deinit()
|
|||
__lib_pl_free(playlist);
|
||||
}
|
||||
}
|
||||
|
||||
void pl_library_update(struct playlist *playlist)
|
||||
{
|
||||
idle_schedule(IDLE_SYNC, __lib_pl_update, playlist);
|
||||
}
|
||||
|
|
|
@ -512,7 +512,6 @@ struct playlist_type pl_system = {
|
|||
.pl_lookup = pl_system_lookup,
|
||||
.pl_get = pl_system_get,
|
||||
.pl_played = pl_system_played,
|
||||
.pl_update = pl_system_update,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -131,10 +131,6 @@ static void pl_user_played(struct track *track)
|
|||
}
|
||||
}
|
||||
|
||||
static void pl_user_update(const gchar *name)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
struct playlist_type pl_user = {
|
||||
.pl_save = pl_user_save,
|
||||
|
@ -142,7 +138,6 @@ struct playlist_type pl_user = {
|
|||
.pl_get = pl_user_get,
|
||||
.pl_new = pl_user_new,
|
||||
.pl_played = pl_user_played,
|
||||
.pl_update = pl_user_update,
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -59,10 +59,6 @@ bool playlist_add(struct playlist *, struct track *);
|
|||
/* Called to remove a track from a playlist. */
|
||||
bool playlist_remove(struct playlist *, struct track *);
|
||||
|
||||
/* Called to update tracks on a playlist. */
|
||||
void playlist_update(enum playlist_type_t, const gchar *);
|
||||
|
||||
|
||||
/* Called to check if a specific track is in the playlist. */
|
||||
bool playlist_has(struct playlist *, struct track *);
|
||||
|
||||
|
|
|
@ -16,4 +16,7 @@ void pl_library_init(struct queue_ops *);
|
|||
/* Called to deinitialize system playlists. */
|
||||
void pl_library_deinit();
|
||||
|
||||
/* Called to update a library path. */
|
||||
void pl_library_update(struct playlist *);
|
||||
|
||||
#endif /* OCARINA_CORE_PLAYLISTS_LIBRARY_H */
|
||||
|
|
|
@ -76,9 +76,6 @@ struct playlist_type {
|
|||
|
||||
/* Called to notify that a track has been played. */
|
||||
void (*pl_played)(struct track *);
|
||||
|
||||
/* Called to update a playlist. */
|
||||
void (*pl_update)(const gchar *);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -84,14 +84,14 @@ void test_library()
|
|||
g_assert_cmpuint(g_slist_length(playlist->pl_queue.q_sort), ==, 1);
|
||||
|
||||
g_rename("tests/Music/Hyrule Symphony/", "tests/Hyrule Symphony/");
|
||||
playlist_update(PL_LIBRARY, "tests/Music");
|
||||
pl_library_update(playlist);
|
||||
while (idle_run_task()) {}
|
||||
g_assert_cmpuint(db_actual_size(track_db_get()), ==, 48);
|
||||
g_assert_cmpuint(track_db_get()->db_size, ==, 35);
|
||||
g_assert_cmpuint(playlist_size(playlist), ==, 35);
|
||||
|
||||
g_rename("tests/Hyrule Symphony", "tests/Music/Hyrule Symphony/");
|
||||
playlist_update(PL_LIBRARY, "tests/Music");
|
||||
pl_library_update(playlist);
|
||||
while (idle_run_task()) {}
|
||||
g_assert_cmpuint(db_actual_size(track_db_get()), ==, 61);
|
||||
g_assert_cmpuint(track_db_get()->db_size, ==, 48);
|
||||
|
|
|
@ -49,7 +49,6 @@ void test_user()
|
|||
g_assert_cmpuint(playlist_size(playlist), ==, 1);
|
||||
playlist_played(track_get(0));
|
||||
|
||||
playlist_update(PL_USER, "Test Playlist");
|
||||
pl_user_deinit();
|
||||
g_assert_cmpuint(db->db_size, ==, 0);
|
||||
pl_user_init(NULL);
|
||||
|
|
Loading…
Reference in New Issue