mirror of
https://github.com/owntone/owntone-server.git
synced 2024-12-26 07:05:57 -05:00
first song not shuffled
This commit is contained in:
parent
843e7c86a0
commit
07b4d6b6a9
17
src/player.c
17
src/player.c
@ -1069,6 +1069,9 @@ source_shuffle(struct player_source *head, struct player_source *tail)
|
|||||||
|
|
||||||
// Count items in queue (excluding head and tail)
|
// Count items in queue (excluding head and tail)
|
||||||
ps = head->shuffle_next;
|
ps = head->shuffle_next;
|
||||||
|
if (!cur_streaming)
|
||||||
|
nitems = 1;
|
||||||
|
else
|
||||||
nitems = 0;
|
nitems = 0;
|
||||||
while (ps != tail)
|
while (ps != tail)
|
||||||
{
|
{
|
||||||
@ -1089,7 +1092,10 @@ source_shuffle(struct player_source *head, struct player_source *tail)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Fill array with items in queue (excluding head and tail)
|
// Fill array with items in queue (excluding head and tail)
|
||||||
|
if (cur_streaming)
|
||||||
ps = head->shuffle_next;
|
ps = head->shuffle_next;
|
||||||
|
else
|
||||||
|
ps = head;
|
||||||
i = 0;
|
i = 0;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -1114,10 +1120,19 @@ source_shuffle(struct player_source *head, struct player_source *tail)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Insert shuffled items between head and tail
|
// Insert shuffled items between head and tail
|
||||||
|
if (cur_streaming)
|
||||||
|
{
|
||||||
ps_array[0]->shuffle_prev = head;
|
ps_array[0]->shuffle_prev = head;
|
||||||
ps_array[nitems - 1]->shuffle_next = tail;
|
ps_array[nitems - 1]->shuffle_next = tail;
|
||||||
head->shuffle_next = ps_array[0];
|
head->shuffle_next = ps_array[0];
|
||||||
tail->shuffle_prev = ps_array[nitems - 1];
|
tail->shuffle_prev = ps_array[nitems - 1];
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
ps_array[0]->shuffle_prev = ps_array[nitems - 1];
|
||||||
|
ps_array[nitems - 1]->shuffle_next = ps_array[0];
|
||||||
|
shuffle_head = ps_array[0];
|
||||||
|
}
|
||||||
|
|
||||||
free(ps_array);
|
free(ps_array);
|
||||||
|
|
||||||
@ -1132,6 +1147,8 @@ source_reshuffle(void)
|
|||||||
|
|
||||||
if (cur_streaming)
|
if (cur_streaming)
|
||||||
head = cur_streaming;
|
head = cur_streaming;
|
||||||
|
else if (shuffle)
|
||||||
|
head = shuffle_head;
|
||||||
else
|
else
|
||||||
head = source_head;
|
head = source_head;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user