From 5d77f422f0e4998130f1defebd08e053188a1a25 Mon Sep 17 00:00:00 2001 From: Ionut Andrei Oanca Date: Sat, 14 Nov 2020 23:40:01 +0100 Subject: Hide some property setters, init null values, update namespaces --- MediaBrowser.Model/SyncPlay/GroupInfoDto.cs | 15 ++++++++++++--- MediaBrowser.Model/SyncPlay/GroupQueueMode.cs | 18 ++++++++++++++++++ MediaBrowser.Model/SyncPlay/GroupRequestType.cs | 10 +++++----- MediaBrowser.Model/SyncPlay/GroupStateType.cs | 8 ++++---- MediaBrowser.Model/SyncPlay/NewGroupRequest.cs | 10 ++++++++-- MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs | 13 ++++++++++--- .../SyncPlay/PlayQueueUpdateReason.cs | 4 ++-- MediaBrowser.Model/SyncPlay/QueueItem.cs | 21 +++++++++++++++------ MediaBrowser.Model/SyncPlay/SendCommand.cs | 15 ++++++++++++--- 9 files changed, 86 insertions(+), 28 deletions(-) create mode 100644 MediaBrowser.Model/SyncPlay/GroupQueueMode.cs (limited to 'MediaBrowser.Model/SyncPlay') diff --git a/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs b/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs index 85b9a35229..16a75eb68e 100644 --- a/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs +++ b/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs @@ -1,5 +1,4 @@ -#nullable disable - +using System; using System.Collections.Generic; namespace MediaBrowser.Model.SyncPlay @@ -9,6 +8,16 @@ namespace MediaBrowser.Model.SyncPlay /// public class GroupInfoDto { + /// + /// Initializes a new instance of the class. + /// + public GroupInfoDto() + { + GroupId = string.Empty; + GroupName = string.Empty; + Participants = new List(); + } + /// /// Gets or sets the group identifier. /// @@ -37,6 +46,6 @@ namespace MediaBrowser.Model.SyncPlay /// Gets or sets the date when this dto has been updated. /// /// The date when this dto has been updated. - public string LastUpdatedAt { get; set; } + public DateTime LastUpdatedAt { get; set; } } } diff --git a/MediaBrowser.Model/SyncPlay/GroupQueueMode.cs b/MediaBrowser.Model/SyncPlay/GroupQueueMode.cs new file mode 100644 index 0000000000..5c9c2627b9 --- /dev/null +++ b/MediaBrowser.Model/SyncPlay/GroupQueueMode.cs @@ -0,0 +1,18 @@ +namespace MediaBrowser.Model.SyncPlay +{ + /// + /// Enum GroupQueueMode. + /// + public enum GroupQueueMode + { + /// + /// Insert items at the end of the queue. + /// + Queue = 0, + + /// + /// Insert items after the currently playing item. + /// + QueueNext = 1 + } +} diff --git a/MediaBrowser.Model/SyncPlay/GroupRequestType.cs b/MediaBrowser.Model/SyncPlay/GroupRequestType.cs index e7361817ca..75c0712364 100644 --- a/MediaBrowser.Model/SyncPlay/GroupRequestType.cs +++ b/MediaBrowser.Model/SyncPlay/GroupRequestType.cs @@ -8,26 +8,26 @@ namespace MediaBrowser.Model.SyncPlay /// /// A user is requesting to create a new group. /// - NewGroup, + NewGroup = 0, /// /// A user is requesting to join a group. /// - JoinGroup, + JoinGroup = 1, /// /// A user is requesting to leave a group. /// - LeaveGroup, + LeaveGroup = 2, /// /// A user is requesting the list of available groups. /// - ListGroups, + ListGroups = 3, /// /// A user is sending a playback command to a group. /// - Playback + Playback = 4 } } diff --git a/MediaBrowser.Model/SyncPlay/GroupStateType.cs b/MediaBrowser.Model/SyncPlay/GroupStateType.cs index 341859b306..7aa454f928 100644 --- a/MediaBrowser.Model/SyncPlay/GroupStateType.cs +++ b/MediaBrowser.Model/SyncPlay/GroupStateType.cs @@ -8,21 +8,21 @@ namespace MediaBrowser.Model.SyncPlay /// /// The group is in idle state. No media is playing. /// - Idle, + Idle = 0, /// /// The group is in wating state. Playback is paused. Will start playing when users are ready. /// - Waiting, + Waiting = 1, /// /// The group is in paused state. Playback is paused. Will resume on play command. /// - Paused, + Paused = 2, /// /// The group is in playing state. Playback is advancing. /// - Playing + Playing = 3 } } diff --git a/MediaBrowser.Model/SyncPlay/NewGroupRequest.cs b/MediaBrowser.Model/SyncPlay/NewGroupRequest.cs index ccab5313f7..eb61a68d15 100644 --- a/MediaBrowser.Model/SyncPlay/NewGroupRequest.cs +++ b/MediaBrowser.Model/SyncPlay/NewGroupRequest.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace MediaBrowser.Model.SyncPlay { /// @@ -7,6 +5,14 @@ namespace MediaBrowser.Model.SyncPlay /// public class NewGroupRequest { + /// + /// Initializes a new instance of the class. + /// + public NewGroupRequest() + { + GroupName = string.Empty; + } + /// /// Gets or sets the group name. /// diff --git a/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs b/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs index 575597e62d..d193b4c663 100644 --- a/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs +++ b/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs @@ -1,5 +1,4 @@ -#nullable disable - +using System; using System.Collections.Generic; namespace MediaBrowser.Model.SyncPlay @@ -9,6 +8,14 @@ namespace MediaBrowser.Model.SyncPlay /// public class PlayQueueUpdate { + /// + /// Initializes a new instance of the class. + /// + public PlayQueueUpdate() + { + Playlist = new List(); + } + /// /// Gets or sets the request type that originated this update. /// @@ -19,7 +26,7 @@ namespace MediaBrowser.Model.SyncPlay /// Gets or sets the UTC time of the last change to the playing queue. /// /// The UTC time of the last change to the playing queue. - public string LastUpdate { get; set; } + public DateTime LastUpdate { get; set; } /// /// Gets or sets the playlist. diff --git a/MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs b/MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs index 4b3f6eb4d6..e78940fe68 100644 --- a/MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs +++ b/MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs @@ -26,12 +26,12 @@ namespace MediaBrowser.Model.SyncPlay MoveItem = 3, /// - /// A user is making changes to the queue. + /// A user is adding items the queue. /// Queue = 4, /// - /// A user is making changes to the queue. + /// A user is adding items to the queue, after the currently playing item. /// QueueNext = 5, diff --git a/MediaBrowser.Model/SyncPlay/QueueItem.cs b/MediaBrowser.Model/SyncPlay/QueueItem.cs index ce253b182c..9c4d3a4ceb 100644 --- a/MediaBrowser.Model/SyncPlay/QueueItem.cs +++ b/MediaBrowser.Model/SyncPlay/QueueItem.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace MediaBrowser.Model.SyncPlay @@ -10,15 +8,26 @@ namespace MediaBrowser.Model.SyncPlay public class QueueItem { /// - /// Gets or sets the item identifier. + /// Initializes a new instance of the class. + /// + /// The item identifier. + /// The playlist identifier of the item. + public QueueItem(Guid itemId, string playlistItemId) + { + ItemId = itemId; + PlaylistItemId = playlistItemId; + } + + /// + /// Gets the item identifier. /// /// The item identifier. - public Guid ItemId { get; set; } + public Guid ItemId { get; } /// - /// Gets or sets the playlist identifier of the item. + /// Gets the playlist identifier of the item. /// /// The playlist identifier of the item. - public string PlaylistItemId { get; set; } + public string PlaylistItemId { get; } } } diff --git a/MediaBrowser.Model/SyncPlay/SendCommand.cs b/MediaBrowser.Model/SyncPlay/SendCommand.cs index b24f7e97bd..a3aa54b380 100644 --- a/MediaBrowser.Model/SyncPlay/SendCommand.cs +++ b/MediaBrowser.Model/SyncPlay/SendCommand.cs @@ -1,4 +1,4 @@ -#nullable disable +using System; namespace MediaBrowser.Model.SyncPlay { @@ -7,6 +7,15 @@ namespace MediaBrowser.Model.SyncPlay /// public class SendCommand { + /// + /// Initializes a new instance of the class. + /// + public SendCommand() + { + GroupId = string.Empty; + PlaylistItemId = string.Empty; + } + /// /// Gets or sets the group identifier. /// @@ -23,7 +32,7 @@ namespace MediaBrowser.Model.SyncPlay /// Gets or sets the UTC time when to execute the command. /// /// The UTC time when to execute the command. - public string When { get; set; } + public DateTime When { get; set; } /// /// Gets or sets the position ticks. @@ -41,6 +50,6 @@ namespace MediaBrowser.Model.SyncPlay /// Gets or sets the UTC time when this command has been emitted. /// /// The UTC time when this command has been emitted. - public string EmittedAt { get; set; } + public DateTime EmittedAt { get; set; } } } -- cgit v1.2.3