diff --git a/core/collection.c b/core/collection.c index 04acbccd..ac135cdb 100644 --- a/core/collection.c +++ b/core/collection.c @@ -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); diff --git a/core/playlists/system.c b/core/playlists/system.c index a3842148..f36d86ee 100644 --- a/core/playlists/system.c +++ b/core/playlists/system.c @@ -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); +} diff --git a/include/core/playlist.h b/include/core/playlist.h index 36f92c42..915d00a6 100644 --- a/include/core/playlist.h +++ b/include/core/playlist.h @@ -8,7 +8,7 @@ #ifndef OCARINA_CORE_PLAYLIST_H #define OCARINA_CORE_PLAYLIST_H -#include +#include #include diff --git a/include/core/playlists/system.h b/include/core/playlists/system.h index 453ce3db..82d91ddd 100644 --- a/include/core/playlists/system.h +++ b/include/core/playlists/system.h @@ -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 */