core/playlists/system: Add pl_system_new_track()

Called to tell system playlists that a new track has been added to the
database.

Signed-off-by: Anna Schumaker <Anna@OcarinaProject.net>
This commit is contained in:
Anna Schumaker 2016-05-09 11:18:28 -04:00 committed by Anna Schumaker
parent 20e0a85a5d
commit 03ed7c4b84
4 changed files with 13 additions and 5 deletions

View File

@ -51,10 +51,8 @@ static void __scan_path(struct scan_data *scan, const gchar *name)
__scan_dir_later(scan->sd_lib, path);
else {
track = track_add(scan->sd_lib, path);
if (track) {
playlist_add(PL_SYSTEM, "Collection", track);
playlist_add(PL_SYSTEM, "Unplayed", track);
}
if (track)
pl_system_new_track(track);
}
g_free(path);

View File

@ -296,3 +296,9 @@ void pl_system_deinit()
for (i = 0; i < SYS_PL_NUM_PLAYLISTS; i++)
queue_deinit(__sys_pl_queue(i));
}
void pl_system_new_track(struct track *track)
{
pl_system_add_track("Collection", track);
pl_system_add_track("Unplayed", track);
}

View File

@ -8,7 +8,7 @@
#ifndef OCARINA_CORE_PLAYLIST_H
#define OCARINA_CORE_PLAYLIST_H
#include <core/playlists/type.h>
#include <core/playlists/system.h>
#include <core/queue.h>

View File

@ -28,4 +28,8 @@ void pl_system_init(struct queue_ops *);
/* Called to deinitialize system playlists. */
void pl_system_deinit();
/* Called to tell system playlists about a new track. */
void pl_system_new_track(struct track *);
#endif /* OCARINA_CORE_PLAYLISTS_SYSTEM_H */