diff --git a/core/collection.c b/core/collection.c index ac135cdb..1348d368 100644 --- a/core/collection.c +++ b/core/collection.c @@ -104,12 +104,7 @@ static bool __validate_library(void *data) if (access < 0) { if (collection_check_library(library) < 0) return true; - playlist_remove(PL_SYSTEM, "Collection", track); - playlist_remove(PL_SYSTEM, "Favorites", track); - playlist_remove(PL_SYSTEM, "Hidden", track); - playlist_remove(PL_SYSTEM, "Least Played", track); - playlist_remove(PL_SYSTEM, "Most Played", track); - playlist_remove(PL_SYSTEM, "Unplayed", track); + pl_system_delete_track(track); track_remove(track); } } diff --git a/core/playlists/system.c b/core/playlists/system.c index f36d86ee..b58554f0 100644 --- a/core/playlists/system.c +++ b/core/playlists/system.c @@ -299,6 +299,14 @@ void pl_system_deinit() void pl_system_new_track(struct track *track) { - pl_system_add_track("Collection", track); - pl_system_add_track("Unplayed", track); + __sys_pl_add(SYS_PL_COLLECTION, track, 0); + __sys_pl_add(SYS_PL_UNPLAYED, track, 0); +} + +void pl_system_delete_track(struct track *track) +{ + unsigned int i; + + for (i = 0; i < SYS_PL_NUM_PLAYLISTS; i++) + __sys_pl_remove(i, track); } diff --git a/include/core/playlists/system.h b/include/core/playlists/system.h index 82d91ddd..3ee759ed 100644 --- a/include/core/playlists/system.h +++ b/include/core/playlists/system.h @@ -32,4 +32,7 @@ void pl_system_deinit(); /* Called to tell system playlists about a new track. */ void pl_system_new_track(struct track *); +/* Called to tell system playlists that a track is getting deleted. */ +void pl_system_delete_track(struct track *); + #endif /* OCARINA_CORE_PLAYLISTS_SYSTEM_H */