From ef8a764780c5f61e7708cd887735980cbb9527f6 Mon Sep 17 00:00:00 2001 From: Anna Schumaker Date: Mon, 22 Aug 2016 11:22:22 -0400 Subject: [PATCH] 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 --- core/playlists/artist.c | 11 +++-------- core/playlists/library.c | 11 +++-------- 2 files changed, 6 insertions(+), 16 deletions(-) diff --git a/core/playlists/artist.c b/core/playlists/artist.c index 3ba1c303..30a9c239 100644 --- a/core/playlists/artist.c +++ b/core/playlists/artist.c @@ -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); } diff --git a/core/playlists/library.c b/core/playlists/library.c index 515ac4c6..b48dfe41 100644 --- a/core/playlists/library.c +++ b/core/playlists/library.c @@ -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); }