first song not shuffled

This commit is contained in:
chme 2015-01-25 10:09:17 +01:00
parent 843e7c86a0
commit 07b4d6b6a9

View File

@ -1069,7 +1069,10 @@ 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;
nitems = 0; if (!cur_streaming)
nitems = 1;
else
nitems = 0;
while (ps != tail) while (ps != tail)
{ {
nitems++; nitems++;
@ -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)
ps = head->shuffle_next; if (cur_streaming)
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
ps_array[0]->shuffle_prev = head; if (cur_streaming)
ps_array[nitems - 1]->shuffle_next = tail; {
head->shuffle_next = ps_array[0]; ps_array[0]->shuffle_prev = head;
tail->shuffle_prev = ps_array[nitems - 1]; ps_array[nitems - 1]->shuffle_next = tail;
head->shuffle_next = ps_array[0];
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;