diff options
| author | Ionut Andrei Oanca <oancaionutandrei@gmail.com> | 2020-11-14 23:40:01 +0100 |
|---|---|---|
| committer | Ionut Andrei Oanca <oancaionutandrei@gmail.com> | 2020-11-14 23:40:01 +0100 |
| commit | 5d77f422f0e4998130f1defebd08e053188a1a25 (patch) | |
| tree | b2c09449450ae6a6160c38195f21c91f8e9a20dd /Emby.Server.Implementations/SyncPlay | |
| parent | fa69f6fd511b88f2c10f37c45e1924b8bfe2e7ec (diff) | |
Hide some property setters, init null values, update namespaces
Diffstat (limited to 'Emby.Server.Implementations/SyncPlay')
| -rw-r--r-- | Emby.Server.Implementations/SyncPlay/GroupController.cs | 49 |
1 files changed, 12 insertions, 37 deletions
diff --git a/Emby.Server.Implementations/SyncPlay/GroupController.cs b/Emby.Server.Implementations/SyncPlay/GroupController.cs index 5447aad5d..a0d951b3e 100644 --- a/Emby.Server.Implementations/SyncPlay/GroupController.cs +++ b/Emby.Server.Implementations/SyncPlay/GroupController.cs @@ -10,6 +10,8 @@ using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Session; using MediaBrowser.Controller.SyncPlay; +using MediaBrowser.Controller.SyncPlay.GroupStates; +using MediaBrowser.Controller.SyncPlay.Queue; using MediaBrowser.Model.SyncPlay; using Microsoft.Extensions.Logging; @@ -358,7 +360,7 @@ namespace Emby.Server.Implementations.SyncPlay GroupName = GroupName, State = _state.Type, Participants = Participants.Values.Select(session => session.Session.UserName).Distinct().ToList(), - LastUpdatedAt = DateToUTCString(DateTime.UtcNow) + LastUpdatedAt = DateTime.UtcNow }; } @@ -422,8 +424,8 @@ namespace Emby.Server.Implementations.SyncPlay PlaylistItemId = PlayQueue.GetPlayingItemPlaylistId(), PositionTicks = PositionTicks, Command = type, - When = DateToUTCString(LastActivity), - EmittedAt = DateToUTCString(DateTime.UtcNow) + When = LastActivity, + EmittedAt = DateTime.UtcNow }; } @@ -439,12 +441,6 @@ namespace Emby.Server.Implementations.SyncPlay } /// <inheritdoc /> - public string DateToUTCString(DateTime dateTime) - { - return dateTime.ToUniversalTime().ToString("o", CultureInfo.InvariantCulture); - } - - /// <inheritdoc /> public long SanitizePositionTicks(long? positionTicks) { var ticks = positionTicks ?? 0; @@ -580,7 +576,7 @@ namespace Emby.Server.Implementations.SyncPlay } /// <inheritdoc /> - public bool AddToPlayQueue(IEnumerable<Guid> newItems, string mode) + public bool AddToPlayQueue(IEnumerable<Guid> newItems, GroupQueueMode mode) { // Ignore on empty list. if (!newItems.Any()) @@ -594,7 +590,7 @@ namespace Emby.Server.Implementations.SyncPlay return false; } - if (mode.Equals("next", StringComparison.OrdinalIgnoreCase)) + if (mode.Equals(GroupQueueMode.QueueNext)) { PlayQueue.QueueNext(newItems); } @@ -648,36 +644,15 @@ namespace Emby.Server.Implementations.SyncPlay } /// <inheritdoc /> - public void SetRepeatMode(string mode) + public void SetRepeatMode(GroupRepeatMode 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; - } + PlayQueue.SetRepeatMode(mode); } /// <inheritdoc /> - public void SetShuffleMode(string mode) + public void SetShuffleMode(GroupShuffleMode mode) { - switch (mode) - { - case "Shuffle": - PlayQueue.SetShuffleMode(GroupShuffleMode.Shuffle); - break; - default: - // On unknown values, default to sorted playlist. - PlayQueue.SetShuffleMode(GroupShuffleMode.Sorted); - break; - } + PlayQueue.SetShuffleMode(mode); } /// <inheritdoc /> @@ -701,7 +676,7 @@ namespace Emby.Server.Implementations.SyncPlay return new PlayQueueUpdate() { Reason = reason, - LastUpdate = DateToUTCString(PlayQueue.LastChange), + LastUpdate = PlayQueue.LastChange, Playlist = PlayQueue.GetPlaylist(), PlayingItemIndex = PlayQueue.PlayingItemIndex, StartPositionTicks = startPositionTicks, |
