From 653082ad1d7a5d55cdaf0a1e8071ebecc5aaa5fc Mon Sep 17 00:00:00 2001 From: Christian Soffke Date: Tue, 18 Oct 2022 19:10:59 +0200 Subject: [PATCH] Database: Adjust "Play Selected First"&"Shuffle" behavior - With "Play Selected First" and "Shuffle" enabled, another item was randomly selected when returning to the list. This appears to be a bug - With "Play Selected First" disabled, the first item was selected. This appeared to be intentional, since, at least with "Shuffle" disabled, that is the item that was played back. This may not be helpful either, since it makes you lose your place in what can be a long list. It is also not consistent with the behavior of the File Browser. The current selection should probably be maintained in all cases. - At least according to the manual and the behavior of the File Browser, "Play Selected First" should only apply when "Shuffle" is enabled. Change-Id: Ic1205477d5bf8b22f8f32dd6d31d3b9ceb5a2d24 --- apps/tagtree.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/apps/tagtree.c b/apps/tagtree.c index 2ebab7949c..0506dd2edd 100644 --- a/apps/tagtree.c +++ b/apps/tagtree.c @@ -2161,6 +2161,8 @@ bool tagtree_insert_selection_playlist(int position, bool queue) static int tagtree_play_folder(struct tree_context* c) { + int start_index = c->selected_item; + if (playlist_create(NULL, NULL) < 0) { logf("Failed creating playlist\n"); @@ -2171,12 +2173,13 @@ static int tagtree_play_folder(struct tree_context* c) return -2; if (global_settings.playlist_shuffle) - c->selected_item = playlist_shuffle(current_tick, c->selected_item); - if (!global_settings.play_selected) - c->selected_item = 0; - gui_synclist_select_item(&tree_lists, c->selected_item); + { + start_index = playlist_shuffle(current_tick, c->selected_item); + if (!global_settings.play_selected) + start_index = 0; + } - playlist_start(c->selected_item, 0, 0); + playlist_start(start_index, 0, 0); playlist_get_current()->num_inserted_tracks = 0; /* make warn on playlist erase work */ return 0; }