diff options
Diffstat (limited to 'apps/plugins/pictureflow/pictureflow.c')
-rw-r--r-- | apps/plugins/pictureflow/pictureflow.c | 37 |
1 files changed, 26 insertions, 11 deletions
diff --git a/apps/plugins/pictureflow/pictureflow.c b/apps/plugins/pictureflow/pictureflow.c index de9859897c..cd8ef1a29f 100644 --- a/apps/plugins/pictureflow/pictureflow.c +++ b/apps/plugins/pictureflow/pictureflow.c | |||
@@ -2330,27 +2330,42 @@ void select_prev_track(void) | |||
2330 | */ | 2330 | */ |
2331 | void start_playback(void) | 2331 | void start_playback(void) |
2332 | { | 2332 | { |
2333 | static int old_playlist = -1; | 2333 | static int old_playlist = -1, old_shuffle = 0; |
2334 | if (center_slide.slide_index == old_playlist) | 2334 | int count = 0; |
2335 | int position = selected_track; | ||
2336 | int shuffle = rb->global_settings->playlist_shuffle; | ||
2337 | /* reuse existing playlist if possible | ||
2338 | * regenerate if shuffle is on or changed, since playlist index and | ||
2339 | * selected track are "out of sync" */ | ||
2340 | if (!shuffle && center_slide.slide_index == old_playlist | ||
2341 | && (old_shuffle == shuffle)) | ||
2335 | { | 2342 | { |
2336 | rb->playlist_start(selected_track, 0); | 2343 | goto play; |
2337 | } | 2344 | } |
2338 | /* First, replace the current playlist with a new one */ | 2345 | /* First, replace the current playlist with a new one */ |
2339 | else if ((rb->playlist_remove_all_tracks(NULL) == 0) && | 2346 | else if (rb->playlist_remove_all_tracks(NULL) == 0 |
2340 | (rb->playlist_create(PLUGIN_DEMOS_DIR, NULL) == 0)) | 2347 | && rb->playlist_create(NULL, NULL) == 0) |
2341 | { | 2348 | { |
2342 | int count = 0; | ||
2343 | do { | 2349 | do { |
2344 | if (rb->playlist_add(get_track_filename(count)) != 0) | 2350 | rb->yield(); |
2351 | if (rb->playlist_insert_track(NULL, get_track_filename(count), | ||
2352 | PLAYLIST_INSERT_LAST, false, true) < 0) | ||
2345 | break; | 2353 | break; |
2346 | } while(++count < track_count); | 2354 | } while(++count < track_count); |
2347 | |||
2348 | rb->playlist_sync(NULL); | 2355 | rb->playlist_sync(NULL); |
2349 | |||
2350 | rb->playlist_start(selected_track, 0); | ||
2351 | } | 2356 | } |
2357 | else | ||
2358 | return; | ||
2359 | |||
2360 | if (rb->global_settings->playlist_shuffle) | ||
2361 | position = rb->playlist_shuffle(*rb->current_tick, selected_track); | ||
2362 | play: | ||
2363 | /* TODO: can we adjust selected_track if !play_selected ? | ||
2364 | * if shuffle, we can't predict the playing track easily, and for either | ||
2365 | * case the track list doesn't get auto scrolled*/ | ||
2366 | rb->playlist_start(position, 0); | ||
2352 | old_playlist = center_slide.slide_index; | 2367 | old_playlist = center_slide.slide_index; |
2353 | 2368 | old_shuffle = shuffle; | |
2354 | } | 2369 | } |
2355 | 2370 | ||
2356 | /** | 2371 | /** |