diff --git a/Emby.Server.Implementations/SyncPlay/GroupController.cs b/Emby.Server.Implementations/SyncPlay/GroupController.cs index 65a711fb42..01e1166171 100644 --- a/Emby.Server.Implementations/SyncPlay/GroupController.cs +++ b/Emby.Server.Implementations/SyncPlay/GroupController.cs @@ -643,12 +643,33 @@ namespace Emby.Server.Implementations.SyncPlay /// public void SetRepeatMode(string mode) { - PlayQueue.SetRepeatMode(mode); + switch (mode) + { + case "RepeatOne": + PlayQueue.SetRepeatMode(GroupRepeatMode.RepeatOne); + break; + case "RepeatAll": + PlayQueue.SetRepeatMode(GroupRepeatMode.RepeatAll); + break; + default: + // On unknown values, default to repeat none. + PlayQueue.SetRepeatMode(GroupRepeatMode.RepeatNone); + break; + } } /// public void SetShuffleMode(string mode) { - PlayQueue.SetShuffleMode(mode); + switch (mode) + { + case "Shuffle": + PlayQueue.SetShuffleMode(GroupShuffleMode.Shuffle); + break; + default: + // On unknown values, default to sorted playlist. + PlayQueue.SetShuffleMode(GroupShuffleMode.Sorted); + break; + } } /// diff --git a/MediaBrowser.Controller/SyncPlay/Queue/PlayQueueManager.cs b/MediaBrowser.Controller/SyncPlay/Queue/PlayQueueManager.cs index 9ab0dfd2ad..030005abe6 100644 --- a/MediaBrowser.Controller/SyncPlay/Queue/PlayQueueManager.cs +++ b/MediaBrowser.Controller/SyncPlay/Queue/PlayQueueManager.cs @@ -461,21 +461,9 @@ namespace MediaBrowser.Controller.SyncPlay /// Sets the repeat mode. /// /// The new mode. - public void SetRepeatMode(string mode) + public void SetRepeatMode(GroupRepeatMode mode) { - switch (mode) - { - case "RepeatOne": - RepeatMode = GroupRepeatMode.RepeatOne; - break; - case "RepeatAll": - RepeatMode = GroupRepeatMode.RepeatAll; - break; - default: - RepeatMode = GroupRepeatMode.RepeatNone; - break; - } - + RepeatMode = mode; LastChange = DateTime.UtcNow; } @@ -483,16 +471,15 @@ namespace MediaBrowser.Controller.SyncPlay /// Sets the shuffle mode. /// /// The new mode. - public void SetShuffleMode(string mode) + public void SetShuffleMode(GroupShuffleMode mode) { - switch (mode) + if (mode.Equals(GroupShuffleMode.Shuffle)) { - case "Shuffle": - ShufflePlaylist(); - break; - default: - RestoreSortedPlaylist(); - break; + ShufflePlaylist(); + } + else + { + RestoreSortedPlaylist(); } } @@ -501,7 +488,14 @@ namespace MediaBrowser.Controller.SyncPlay /// public void ToggleShuffleMode() { - SetShuffleMode(ShuffleMode.Equals(GroupShuffleMode.Shuffle) ? "Shuffle" : ""); + if (ShuffleMode.Equals(GroupShuffleMode.Sorted)) + { + ShufflePlaylist(); + } + else + { + RestoreSortedPlaylist(); + } } ///