Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
478180eb
Commit
478180eb
authored
Dec 02, 2017
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
queue/PlaylistEdit: shuffle appended songs only within its priority group
Fixes #165.
parent
4a3059f5
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
6 deletions
+20
-6
NEWS
NEWS
+1
-0
PlaylistEdit.cxx
src/queue/PlaylistEdit.cxx
+1
-1
Queue.cxx
src/queue/Queue.cxx
+13
-1
Queue.hxx
src/queue/Queue.hxx
+5
-4
No files found.
NEWS
View file @
478180eb
...
@@ -2,6 +2,7 @@ ver 0.20.13 (not yet released)
...
@@ -2,6 +2,7 @@ ver 0.20.13 (not yet released)
* database
* database
- simple: don't purge mount points on update/rescan
- simple: don't purge mount points on update/rescan
- upnp: work around libupnp 1.6.24 API breakage
- upnp: work around libupnp 1.6.24 API breakage
* queue: fix spuriously misplaced prioritized songs
ver 0.20.12 (2017/11/25)
ver 0.20.12 (2017/11/25)
* database
* database
...
...
src/queue/PlaylistEdit.cxx
View file @
478180eb
...
@@ -112,7 +112,7 @@ playlist::AppendSong(PlayerControl &pc, DetachedSong &&song)
...
@@ -112,7 +112,7 @@ playlist::AppendSong(PlayerControl &pc, DetachedSong &&song)
else
else
start
=
current
+
1
;
start
=
current
+
1
;
if
(
start
<
queue
.
GetLength
())
if
(
start
<
queue
.
GetLength
())
queue
.
ShuffleOrderLast
(
start
,
queue
.
GetLength
());
queue
.
ShuffleOrderLast
WithPriority
(
start
,
queue
.
GetLength
());
}
}
UpdateQueuedSong
(
pc
,
queued_song
);
UpdateQueuedSong
(
pc
,
queued_song
);
...
...
src/queue/Queue.cxx
View file @
478180eb
...
@@ -364,8 +364,20 @@ Queue::ShuffleOrderFirst(unsigned start, unsigned end)
...
@@ -364,8 +364,20 @@ Queue::ShuffleOrderFirst(unsigned start, unsigned end)
}
}
void
void
Queue
::
ShuffleOrderLast
(
unsigned
start
,
unsigned
end
)
Queue
::
ShuffleOrderLast
WithPriority
(
unsigned
start
,
unsigned
end
)
{
{
assert
(
end
<=
length
);
assert
(
start
<
end
);
/* skip all items at the start which have a higher priority,
because the last item shall only be shuffled within its
priority group */
const
auto
last_priority
=
items
[
OrderToPosition
(
end
-
1
)].
priority
;
while
(
items
[
OrderToPosition
(
start
)].
priority
!=
last_priority
)
{
++
start
;
assert
(
start
<
end
);
}
rand
.
AutoCreate
();
rand
.
AutoCreate
();
std
::
uniform_int_distribution
<
unsigned
>
distribution
(
start
,
end
-
1
);
std
::
uniform_int_distribution
<
unsigned
>
distribution
(
start
,
end
-
1
);
...
...
src/queue/Queue.hxx
View file @
478180eb
...
@@ -356,11 +356,12 @@ struct Queue {
...
@@ -356,11 +356,12 @@ struct Queue {
void
ShuffleOrderFirst
(
unsigned
start
,
unsigned
end
);
void
ShuffleOrderFirst
(
unsigned
start
,
unsigned
end
);
/**
/**
* Shuffles the virtual order of the last song in the specified
* Shuffles the virtual order of the last song in the
* (order) range. This is used in random mode after a song has been
* specified (order) range; only songs which match this song's
* appended by queue_append().
* priority are considered. This is used in random mode after
* a song has been appended by Append().
*/
*/
void
ShuffleOrderLast
(
unsigned
start
,
unsigned
end
);
void
ShuffleOrderLast
WithPriority
(
unsigned
start
,
unsigned
end
);
/**
/**
* Shuffles a (position) range in the queue. The songs are physically
* Shuffles a (position) range in the queue. The songs are physically
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment