Shuffle: Start with random track if not selecting track directly

Starting a playlist, album or artist with shuffle enabled always
starts on the first track in it and then plays the rest of the
queue shuffled.
This changes it so unless a track is picked directly, playback
will start on a random track of the selection.
This commit is contained in:
Tobias Langendorf
2020-02-20 11:11:01 +01:00
committed by Henrik Friedrichsen
parent f292b939b3
commit 363e71242a
7 changed files with 17 additions and 12 deletions

View File

@@ -148,7 +148,7 @@ impl<I: ListItem> ListView<I> {
if let Some(tracks) = any.downcast_ref::<Vec<Track>>() {
let tracks: Vec<&Track> = tracks.iter().collect();
let index = self.queue.append_next(tracks);
self.queue.play(index + self.selected, true);
self.queue.play(index + self.selected, true, false);
true
} else {
false

View File

@@ -92,7 +92,7 @@ impl ViewExt for QueueView {
fn on_command(&mut self, s: &mut Cursive, cmd: &Command) -> Result<CommandResult, String> {
match cmd {
Command::Play => {
self.queue.play(self.list.get_selected_index(), true);
self.queue.play(self.list.get_selected_index(), true, false);
return Ok(CommandResult::Consumed(None));
}
Command::Queue => {