Skip to content

Commit

Permalink
[Fixed] "Shuffle all" doesn't shuffle
Browse files Browse the repository at this point in the history
  • Loading branch information
raphgodart committed Jan 2, 2017
1 parent 6cadb82 commit e7b6e29
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,7 @@ private void Initialize()
}
});

this.ShuffleAllCommand = new DelegateCommand(() =>
{
this.playbackService.SetShuffle(true);
this.playbackService.Enqueue();
});
this.ShuffleAllCommand = new DelegateCommand(() => this.playbackService.ShuffleAllAsync());

// Initialize Handlers
this.playbackService.PlaybackFailed += (_, __) => this.ShowPlayingTrackAsync();
Expand Down
1 change: 1 addition & 0 deletions Dopamine.Common/Services/Playback/IPlaybackService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public interface IPlaybackService
Task Enqueue(Genre genre);
Task Enqueue(Album album);
Task Enqueue(Playlist playlist);
Task ShuffleAllAsync();
Task<AddToQueueResult> AddToQueue(IList<MergedTrack> tracks);
Task<AddToQueueResult> AddToQueue(IList<Artist> artists);
Task<AddToQueueResult> AddToQueue(IList<Genre> genres);
Expand Down
14 changes: 14 additions & 0 deletions Dopamine.Common/Services/Playback/PlaybackService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,20 @@ public async Task PlayPreviousAsync()
}
}

public async Task ShuffleAllAsync()
{
List<MergedTrack> tracks = await Database.Utils.OrderTracksAsync(await this.trackRepository.GetTracksAsync(), TrackOrder.ByAlbum);

lock (this.queueSyncObject)
{
this.queuedTracks = new List<MergedTrack>(tracks);
}

await this.SetPlaybackSettingsAsync();
if(!this.shuffle) await SetShuffle(true); // Make sure tracks get shuffled
await this.PlayFirstAsync();
}

public async Task Enqueue()
{
List<MergedTrack> tracks = await Database.Utils.OrderTracksAsync(await this.trackRepository.GetTracksAsync(), TrackOrder.ByAlbum);
Expand Down
3 changes: 2 additions & 1 deletion Dopamine/Changelog.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
2017-01-02: Dopamine 1.2.4 Build 861 (Release)
2017-01-03: Dopamine 1.2.4 Build 862 (Release)
----------------------------------------------

- [Fixed] Artists are not sorted alphabetically
- [Fixed] "Shuffle all" doesn't shuffle


2017-01-01: Dopamine 1.2.3 Build 860 (Release)
Expand Down
2 changes: 1 addition & 1 deletion Dopamine/Dopamine.wxs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<?define Version="1.2.861.4" ?>
<?define Version="1.2.862.4" ?>
<?define Manufacturer="Digimezzo" ?>
<?define Product="Dopamine" ?>
<?define ProductCab="Dopamine.cab" ?>
Expand Down
8 changes: 4 additions & 4 deletions Dopamine/SharedAssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

[assembly: AssemblyCompany("Digimezzo")]
[assembly: AssemblyCopyright("Copyright Digimezzo © 2014 - 2017")]
[assembly: AssemblyVersion("1.2.861.4")]
[assembly: AssemblyFileVersion("1.2.861.4")]
[assembly: AssemblyVersion("1.2.862.4")]
[assembly: AssemblyFileVersion("1.2.862.4")]

#if DEBUG
[assembly: AssemblyInformationalVersion("1.2.861.4 Preview")]
[assembly: AssemblyInformationalVersion("1.2.862.4 Preview")]
#else
[assembly: AssemblyInformationalVersion("1.2.861.4")]
[assembly: AssemblyInformationalVersion("1.2.862.4")]
#endif

0 comments on commit e7b6e29

Please sign in to comment.