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
This commit is contained in:
Christian Soffke 2022-10-18 19:10:59 +02:00
parent e27a6bad4f
commit 653082ad1d

View file

@ -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;
}