core/playlists/system: Add pl_system_delete_track()

Called to remove a track from all system playlists.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-05-09 12:17:22 -04:00 committed by Anna Schumaker
parent 03ed7c4b84
commit e4930704a2
3 changed files with 14 additions and 8 deletions

View File

@ -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);
}
}

View File

@ -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);
}

View File

@ -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 */