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 (access < 0) {
if (collection_check_library(library) < 0) if (collection_check_library(library) < 0)
return true; return true;
playlist_remove(PL_SYSTEM, "Collection", track); pl_system_delete_track(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);
track_remove(track); track_remove(track);
} }
} }

View File

@ -299,6 +299,14 @@ void pl_system_deinit()
void pl_system_new_track(struct track *track) void pl_system_new_track(struct track *track)
{ {
pl_system_add_track("Collection", track); __sys_pl_add(SYS_PL_COLLECTION, track, 0);
pl_system_add_track("Unplayed", track); __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. */ /* Called to tell system playlists about a new track. */
void pl_system_new_track(struct 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 */ #endif /* OCARINA_CORE_PLAYLISTS_SYSTEM_H */