core/playlists/artists: Load each playlist with a different idle task
This seems less efficient overall, since we now need to take several passes over the track database. What I've noticed is that the single-pass option creates a lot of UI notifications that makes the gui unresponsive for a large amount of time. Breaking this into smaller chunks gives us a chance to handle any user actions between loading each playlist. Fixes #71: Initalize artist playlists with more idle tasks Signed-off-by: Anna Schumaker <Anna@NoWheyCreamery.com>
This commit is contained in:
parent
73b33e9718
commit
5964c508ce
|
@ -1,4 +1,5 @@
|
||||||
6.4.18:
|
6.4.18:
|
||||||
|
- Load each artist playlist in a separate idle task
|
||||||
- UI spacing improvements
|
- UI spacing improvements
|
||||||
|
|
||||||
6.4.18-rc:
|
6.4.18-rc:
|
||||||
|
|
|
@ -28,13 +28,16 @@ static void __artist_pl_free(struct playlist *playlist)
|
||||||
|
|
||||||
static bool __artist_pl_load(void *data)
|
static bool __artist_pl_load(void *data)
|
||||||
{
|
{
|
||||||
struct playlist *playlist;
|
struct playlist *playlist = (struct playlist *)data;
|
||||||
|
struct artist *artist = artist_lookup(playlist->pl_name);
|
||||||
struct db_entry *dbe, *next;
|
struct db_entry *dbe, *next;
|
||||||
|
|
||||||
|
queue_set_flag(&playlist->pl_queue, Q_ADD_FRONT);
|
||||||
db_for_each(dbe, next, track_db_get()) {
|
db_for_each(dbe, next, track_db_get()) {
|
||||||
playlist = TRACK(dbe)->tr_artist->ar_playlist;
|
if (TRACK(dbe)->tr_artist == artist)
|
||||||
queue_add(&playlist->pl_queue, TRACK(dbe));
|
queue_add(&playlist->pl_queue, TRACK(dbe));
|
||||||
}
|
}
|
||||||
|
queue_unset_flag(&playlist->pl_queue, Q_ADD_FRONT);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -95,6 +98,8 @@ static bool __artist_pl_init(void *data)
|
||||||
db_for_each(dbe, next, artist_db_get()) {
|
db_for_each(dbe, next, artist_db_get()) {
|
||||||
playlist = __artist_pl_alloc(ARTIST(dbe)->ar_name);
|
playlist = __artist_pl_alloc(ARTIST(dbe)->ar_name);
|
||||||
ARTIST(dbe)->ar_playlist = playlist;
|
ARTIST(dbe)->ar_playlist = playlist;
|
||||||
|
|
||||||
|
idle_schedule(IDLE_SYNC, __artist_pl_load, playlist);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -104,7 +109,6 @@ void pl_artist_init(struct queue_ops *ops)
|
||||||
{
|
{
|
||||||
artist_ops = ops;
|
artist_ops = ops;
|
||||||
idle_schedule(IDLE_SYNC, __artist_pl_init, NULL);
|
idle_schedule(IDLE_SYNC, __artist_pl_init, NULL);
|
||||||
idle_schedule(IDLE_SYNC, __artist_pl_load, NULL);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void pl_artist_deinit()
|
void pl_artist_deinit()
|
||||||
|
|
Loading…
Reference in New Issue