core/playlists/artist: Add artist playlists as artists are added
Scanning new library paths should also add artist playlists, otherwise they won't show up until Ocarina is restarted. Fixes #79: Artist playlists not updated when tracks are added Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
3d31349cca
commit
a430c5b117
|
@ -123,3 +123,16 @@ void pl_artist_deinit()
|
|||
__artist_pl_free(playlist);
|
||||
}
|
||||
}
|
||||
|
||||
void pl_artist_new_track(struct track *track)
|
||||
{
|
||||
struct artist *artist = track->tr_artist;
|
||||
struct playlist *playlist = (struct playlist *)artist->ar_playlist;
|
||||
|
||||
if (!playlist) {
|
||||
playlist = __artist_pl_alloc(artist->ar_name);
|
||||
artist->ar_playlist = playlist;
|
||||
}
|
||||
|
||||
queue_add(&playlist->pl_queue, track);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* Copyright 2016 (c) Anna Schumaker.
|
||||
*/
|
||||
#include <core/idle.h>
|
||||
#include <core/playlists/system.h>
|
||||
#include <core/playlists/artist.h>
|
||||
#include <core/playlists/library.h>
|
||||
#include <core/playlists/system.h>
|
||||
#include <unistd.h>
|
||||
|
@ -84,6 +84,7 @@ static void __lib_pl_read_path(struct scan_data *scan, const gchar *name)
|
|||
if (track) {
|
||||
queue_add(&playlist->pl_queue, track);
|
||||
pl_system_new_track(track);
|
||||
pl_artist_new_track(track);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,4 +15,7 @@ void pl_artist_init(struct queue_ops *ops);
|
|||
/* Called to deinitialize library playlists. */
|
||||
void pl_artist_deinit();
|
||||
|
||||
/* Called to tell system playlists about a new track. */
|
||||
void pl_artist_new_track(struct track *);
|
||||
|
||||
#endif /* OCARINA_CORE_PLAYLISTS_ARTIST_H */
|
||||
|
|
Loading…
Reference in New Issue