core/playlists: Allocate artist and library playlists during startup

Rather than waiting for them to load with an idle task.  This speeds up
Ocarina startup dramatically, since playlists can be added to the UI
with the correct size instead of needing extra callbacks to update the
size each time a track is added.

Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
Anna Schumaker 2016-08-22 11:22:22 -04:00
parent 27436115c7
commit ef8a764780
2 changed files with 6 additions and 16 deletions

View File

@ -173,11 +173,13 @@ struct playlist_type pl_artist = {
};
static bool __artist_pl_init(void *data)
void pl_artist_init(struct queue_ops *ops)
{
struct db_entry *dbe, *next;
struct playlist *playlist;
artist_ops = ops;
db_for_each(dbe, next, artist_db_get()) {
playlist = __artist_pl_alloc(ARTIST(dbe)->ar_name);
ARTIST(dbe)->ar_playlist = playlist;
@ -185,13 +187,6 @@ static bool __artist_pl_init(void *data)
idle_schedule(IDLE_SYNC, __artist_pl_add, playlist);
}
return true;
}
void pl_artist_init(struct queue_ops *ops)
{
artist_ops = ops;
idle_schedule(IDLE_SYNC, __artist_pl_init, NULL);
idle_schedule(IDLE_SYNC, __artist_pl_load, NULL);
}

View File

@ -295,11 +295,13 @@ struct playlist_type pl_library = {
};
static bool __lib_pl_init(void *data)
void pl_library_init(struct queue_ops *ops)
{
struct db_entry *dbe, *next;
struct playlist *playlist;
lib_ops = ops;
db_for_each(dbe, next, library_db_get()) {
playlist = __lib_pl_alloc(LIBRARY(dbe));
LIBRARY(dbe)->li_playlist = playlist;
@ -308,13 +310,6 @@ static bool __lib_pl_init(void *data)
pl_library_update(playlist->pl_name);
}
return true;
}
void pl_library_init(struct queue_ops *ops)
{
lib_ops = ops;
idle_schedule(IDLE_SYNC, __lib_pl_init, NULL);
idle_schedule(IDLE_SYNC, __lib_pl_load, NULL);
}