aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/SyncPlay
diff options
context:
space:
mode:
authorIonut Andrei Oanca <oancaionutandrei@gmail.com>2020-09-24 23:04:21 +0200
committerIonut Andrei Oanca <oancaionutandrei@gmail.com>2020-10-16 12:06:29 +0200
commit8819a9d478e6fc11dbfdcff80d9a2dc175953373 (patch)
tree8a159745dd08ebfa6d83e881c8eb6a07df0a589d /MediaBrowser.Model/SyncPlay
parented2eabec16aafdf795f5ea4f8834ffdc74bc149f (diff)
Add playlist-sync and group-wait to SyncPlay
Diffstat (limited to 'MediaBrowser.Model/SyncPlay')
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupInfoDto.cs26
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupRepeatMode.cs23
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupShuffleMode.cs18
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupStateUpdate.cs22
-rw-r--r--MediaBrowser.Model/SyncPlay/GroupUpdateType.cs8
-rw-r--r--MediaBrowser.Model/SyncPlay/JoinGroupRequest.cs4
-rw-r--r--MediaBrowser.Model/SyncPlay/NewGroupRequest.cs16
-rw-r--r--MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs52
-rw-r--r--MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs58
-rw-r--r--MediaBrowser.Model/SyncPlay/PlaybackRequestType.cs70
-rw-r--r--MediaBrowser.Model/SyncPlay/QueueItem.cs24
-rw-r--r--MediaBrowser.Model/SyncPlay/SendCommand.cs6
-rw-r--r--MediaBrowser.Model/SyncPlay/SendCommandType.cs11
13 files changed, 308 insertions, 30 deletions
diff --git a/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs b/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs
index ac84a26dc..255f6812b 100644
--- a/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs
+++ b/MediaBrowser.Model/SyncPlay/GroupInfoDto.cs
@@ -5,7 +5,7 @@ using System.Collections.Generic;
namespace MediaBrowser.Model.SyncPlay
{
/// <summary>
- /// Class GroupInfoView.
+ /// Class GroupInfoDto.
/// </summary>
public class GroupInfoDto
{
@@ -16,27 +16,27 @@ namespace MediaBrowser.Model.SyncPlay
public string GroupId { get; set; }
/// <summary>
- /// Gets or sets the playing item id.
+ /// Gets or sets the group name.
/// </summary>
- /// <value>The playing item id.</value>
- public string PlayingItemId { get; set; }
+ /// <value>The group name.</value>
+ public string GroupName { get; set; }
/// <summary>
- /// Gets or sets the playing item name.
+ /// Gets or sets the group state.
/// </summary>
- /// <value>The playing item name.</value>
- public string PlayingItemName { get; set; }
-
- /// <summary>
- /// Gets or sets the position ticks.
- /// </summary>
- /// <value>The position ticks.</value>
- public long PositionTicks { get; set; }
+ /// <value>The group state.</value>
+ public GroupState State { get; set; }
/// <summary>
/// Gets or sets the participants.
/// </summary>
/// <value>The participants.</value>
public IReadOnlyList<string> Participants { get; set; }
+
+ /// <summary>
+ /// Gets or sets the date when this dto has been updated.
+ /// </summary>
+ /// <value>The date when this dto has been updated.</value>
+ public string LastUpdatedAt { get; set; }
}
}
diff --git a/MediaBrowser.Model/SyncPlay/GroupRepeatMode.cs b/MediaBrowser.Model/SyncPlay/GroupRepeatMode.cs
new file mode 100644
index 000000000..4895e57b7
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/GroupRepeatMode.cs
@@ -0,0 +1,23 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Enum GroupRepeatMode.
+ /// </summary>
+ public enum GroupRepeatMode
+ {
+ /// <summary>
+ /// Repeat one item only.
+ /// </summary>
+ RepeatOne = 0,
+
+ /// <summary>
+ /// Cycle the playlist.
+ /// </summary>
+ RepeatAll = 1,
+
+ /// <summary>
+ /// Do not repeat.
+ /// </summary>
+ RepeatNone = 2
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/GroupShuffleMode.cs b/MediaBrowser.Model/SyncPlay/GroupShuffleMode.cs
new file mode 100644
index 000000000..de860883c
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/GroupShuffleMode.cs
@@ -0,0 +1,18 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Enum GroupShuffleMode.
+ /// </summary>
+ public enum GroupShuffleMode
+ {
+ /// <summary>
+ /// Sorted playlist.
+ /// </summary>
+ Sorted = 0,
+
+ /// <summary>
+ /// Shuffled playlist.
+ /// </summary>
+ Shuffle = 1
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/GroupStateUpdate.cs b/MediaBrowser.Model/SyncPlay/GroupStateUpdate.cs
new file mode 100644
index 000000000..7c7b267e6
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/GroupStateUpdate.cs
@@ -0,0 +1,22 @@
+#nullable disable
+
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Class GroupStateUpdate.
+ /// </summary>
+ public class GroupStateUpdate
+ {
+ /// <summary>
+ /// Gets or sets the state of the group.
+ /// </summary>
+ /// <value>The state of the group.</value>
+ public GroupState State { get; set; }
+
+ /// <summary>
+ /// Gets or sets the reason of the state change.
+ /// </summary>
+ /// <value>The reason of the state change.</value>
+ public PlaybackRequestType Reason { get; set; }
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs b/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs
index c749f7b13..7423bff11 100644
--- a/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs
+++ b/MediaBrowser.Model/SyncPlay/GroupUpdateType.cs
@@ -26,14 +26,14 @@ namespace MediaBrowser.Model.SyncPlay
GroupLeft,
/// <summary>
- /// The group-wait update. Tells members of the group that a user is buffering.
+ /// The group-state update. Tells members of the group that the state changed.
/// </summary>
- GroupWait,
+ StateUpdate,
/// <summary>
- /// The prepare-session update. Tells a user to load some content.
+ /// The play-queue update. Tells a user what's the playing queue of the group.
/// </summary>
- PrepareSession,
+ PlayQueue,
/// <summary>
/// The not-in-group error. Tells a user that they don't belong to a group.
diff --git a/MediaBrowser.Model/SyncPlay/JoinGroupRequest.cs b/MediaBrowser.Model/SyncPlay/JoinGroupRequest.cs
index 0c77a6132..04f3a73b1 100644
--- a/MediaBrowser.Model/SyncPlay/JoinGroupRequest.cs
+++ b/MediaBrowser.Model/SyncPlay/JoinGroupRequest.cs
@@ -8,9 +8,9 @@ namespace MediaBrowser.Model.SyncPlay
public class JoinGroupRequest
{
/// <summary>
- /// Gets or sets the Group id.
+ /// Gets or sets the group id.
/// </summary>
- /// <value>The Group id to join.</value>
+ /// <value>The id of the group to join.</value>
public Guid GroupId { get; set; }
}
}
diff --git a/MediaBrowser.Model/SyncPlay/NewGroupRequest.cs b/MediaBrowser.Model/SyncPlay/NewGroupRequest.cs
new file mode 100644
index 000000000..ccab5313f
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/NewGroupRequest.cs
@@ -0,0 +1,16 @@
+#nullable disable
+
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Class NewGroupRequest.
+ /// </summary>
+ public class NewGroupRequest
+ {
+ /// <summary>
+ /// Gets or sets the group name.
+ /// </summary>
+ /// <value>The name of the new group.</value>
+ public string GroupName { get; set; }
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs b/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs
new file mode 100644
index 000000000..5e2740a89
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/PlayQueueUpdate.cs
@@ -0,0 +1,52 @@
+#nullable disable
+
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Class PlayQueueUpdate.
+ /// </summary>
+ public class PlayQueueUpdate
+ {
+ /// <summary>
+ /// Gets or sets the request type that originated this update.
+ /// </summary>
+ /// <value>The reason for the update.</value>
+ public PlayQueueUpdateReason Reason { get; set; }
+
+ /// <summary>
+ /// Gets or sets the UTC time of the last change to the playing queue.
+ /// </summary>
+ /// <value>The UTC time of the last change to the playing queue.</value>
+ public string LastUpdate { get; set; }
+
+ /// <summary>
+ /// Gets or sets the playlist.
+ /// </summary>
+ /// <value>The playlist.</value>
+ public QueueItem[] Playlist { get; set; }
+
+ /// <summary>
+ /// Gets or sets the playing item index in the playlist.
+ /// </summary>
+ /// <value>The playing item index in the playlist.</value>
+ public int PlayingItemIndex { get; set; }
+
+ /// <summary>
+ /// Gets or sets the start position ticks.
+ /// </summary>
+ /// <value>The start position ticks.</value>
+ public long StartPositionTicks { get; set; }
+
+ /// <summary>
+ /// Gets or sets the shuffle mode.
+ /// </summary>
+ /// <value>The shuffle mode.</value>
+ public GroupShuffleMode ShuffleMode { get; set; }
+
+ /// <summary>
+ /// Gets or sets the repeat mode.
+ /// </summary>
+ /// <value>The repeat mode.</value>
+ public GroupRepeatMode RepeatMode { get; set; }
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs b/MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs
new file mode 100644
index 000000000..4b3f6eb4d
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/PlayQueueUpdateReason.cs
@@ -0,0 +1,58 @@
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Enum PlayQueueUpdateReason.
+ /// </summary>
+ public enum PlayQueueUpdateReason
+ {
+ /// <summary>
+ /// A user is requesting to play a new playlist.
+ /// </summary>
+ NewPlaylist = 0,
+
+ /// <summary>
+ /// A user is changing the playing item.
+ /// </summary>
+ SetCurrentItem = 1,
+
+ /// <summary>
+ /// A user is removing items from the playlist.
+ /// </summary>
+ RemoveItems = 2,
+
+ /// <summary>
+ /// A user is moving an item in the playlist.
+ /// </summary>
+ MoveItem = 3,
+
+ /// <summary>
+ /// A user is making changes to the queue.
+ /// </summary>
+ Queue = 4,
+
+ /// <summary>
+ /// A user is making changes to the queue.
+ /// </summary>
+ QueueNext = 5,
+
+ /// <summary>
+ /// A user is requesting the next item in queue.
+ /// </summary>
+ NextTrack = 6,
+
+ /// <summary>
+ /// A user is requesting the previous item in queue.
+ /// </summary>
+ PreviousTrack = 7,
+
+ /// <summary>
+ /// A user is changing repeat mode.
+ /// </summary>
+ RepeatMode = 8,
+
+ /// <summary>
+ /// A user is changing shuffle mode.
+ /// </summary>
+ ShuffleMode = 9
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/PlaybackRequestType.cs b/MediaBrowser.Model/SyncPlay/PlaybackRequestType.cs
index e89efeed8..0d0f48ea9 100644
--- a/MediaBrowser.Model/SyncPlay/PlaybackRequestType.cs
+++ b/MediaBrowser.Model/SyncPlay/PlaybackRequestType.cs
@@ -6,33 +6,87 @@ namespace MediaBrowser.Model.SyncPlay
public enum PlaybackRequestType
{
/// <summary>
- /// A user is requesting a play command for the group.
+ /// A user is setting a new playlist.
/// </summary>
Play = 0,
/// <summary>
+ /// A user is changing the playlist item.
+ /// </summary>
+ SetPlaylistItem = 1,
+
+ /// <summary>
+ /// A user is removing items from the playlist.
+ /// </summary>
+ RemoveFromPlaylist = 2,
+
+ /// <summary>
+ /// A user is moving an item in the playlist.
+ /// </summary>
+ MovePlaylistItem = 3,
+
+ /// <summary>
+ /// A user is adding items to the playlist.
+ /// </summary>
+ Queue = 4,
+
+ /// <summary>
+ /// A user is requesting an unpause command for the group.
+ /// </summary>
+ Unpause = 5,
+
+ /// <summary>
/// A user is requesting a pause command for the group.
/// </summary>
- Pause = 1,
+ Pause = 6,
/// <summary>
- /// A user is requesting a seek command for the group.
+ /// A user is requesting a stop command for the group.
/// </summary>
- Seek = 2,
+ Stop = 7,
/// <summary>
+ /// A user is requesting a seek command for the group.
+ /// </summary>
+ Seek = 8,
+
+ /// <summary>
/// A user is signaling that playback is buffering.
/// </summary>
- Buffer = 3,
+ Buffer = 9,
/// <summary>
/// A user is signaling that playback resumed.
/// </summary>
- Ready = 4,
+ Ready = 10,
+
+ /// <summary>
+ /// A user is requesting next track in playlist.
+ /// </summary>
+ NextTrack = 11,
+
+ /// <summary>
+ /// A user is requesting previous track in playlist.
+ /// </summary>
+ PreviousTrack = 12,
+ /// <summary>
+ /// A user is setting the repeat mode.
+ /// </summary>
+ SetRepeatMode = 13,
+
+ /// <summary>
+ /// A user is setting the shuffle mode.
+ /// </summary>
+ SetShuffleMode = 14,
+
+ /// <summary>
+ /// A user is reporting their ping.
+ /// </summary>
+ Ping = 15,
/// <summary>
- /// A user is reporting its ping.
+ /// A user is requesting to be ignored on group wait.
/// </summary>
- Ping = 5
+ IgnoreWait = 16
}
}
diff --git a/MediaBrowser.Model/SyncPlay/QueueItem.cs b/MediaBrowser.Model/SyncPlay/QueueItem.cs
new file mode 100644
index 000000000..dc9cfbc22
--- /dev/null
+++ b/MediaBrowser.Model/SyncPlay/QueueItem.cs
@@ -0,0 +1,24 @@
+#nullable disable
+
+using System;
+
+namespace MediaBrowser.Model.SyncPlay
+{
+ /// <summary>
+ /// Class QueueItem.
+ /// </summary>
+ public class QueueItem
+ {
+ /// <summary>
+ /// Gets or sets the item id.
+ /// </summary>
+ /// <value>The item id.</value>
+ public Guid ItemId { get; set; }
+
+ /// <summary>
+ /// Gets or sets the playlist id of the item.
+ /// </summary>
+ /// <value>The playlist id of the item.</value>
+ public string PlaylistItemId { get; set; }
+ }
+}
diff --git a/MediaBrowser.Model/SyncPlay/SendCommand.cs b/MediaBrowser.Model/SyncPlay/SendCommand.cs
index 0f0be0152..779f711af 100644
--- a/MediaBrowser.Model/SyncPlay/SendCommand.cs
+++ b/MediaBrowser.Model/SyncPlay/SendCommand.cs
@@ -14,6 +14,12 @@ namespace MediaBrowser.Model.SyncPlay
public string GroupId { get; set; }
/// <summary>
+ /// Gets or sets the playlist id of the playing item.
+ /// </summary>
+ /// <value>The playlist id of the playing item.</value>
+ public string PlaylistItemId { get; set; }
+
+ /// <summary>
/// Gets or sets the UTC time when to execute the command.
/// </summary>
/// <value>The UTC time when to execute the command.</value>
diff --git a/MediaBrowser.Model/SyncPlay/SendCommandType.cs b/MediaBrowser.Model/SyncPlay/SendCommandType.cs
index 86dec9e90..e6b17c60a 100644
--- a/MediaBrowser.Model/SyncPlay/SendCommandType.cs
+++ b/MediaBrowser.Model/SyncPlay/SendCommandType.cs
@@ -6,9 +6,9 @@ namespace MediaBrowser.Model.SyncPlay
public enum SendCommandType
{
/// <summary>
- /// The play command. Instructs users to start playback.
+ /// The unpause command. Instructs users to unpause playback.
/// </summary>
- Play = 0,
+ Unpause = 0,
/// <summary>
/// The pause command. Instructs users to pause playback.
@@ -16,8 +16,13 @@ namespace MediaBrowser.Model.SyncPlay
Pause = 1,
/// <summary>
+ /// The stop command. Instructs users to stop playback.
+ /// </summary>
+ Stop = 2,
+
+ /// <summary>
/// The seek command. Instructs users to seek to a specified time.
/// </summary>
- Seek = 2
+ Seek = 3
}
}