Add playlist-sync and group-wait to SyncPlay

This commit is contained in:
Ionut Andrei Oanca
2020-09-24 23:04:21 +02:00
parent ed2eabec16
commit 8819a9d478
51 changed files with 3846 additions and 1125 deletions

View File

@@ -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; }
}
}

View File

@@ -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
}
}

View File

@@ -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
}
}

View File

@@ -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; }
}
}

View File

@@ -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.

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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; }
}
}

View File

@@ -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
}
}

View File

@@ -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 stop command for the group.
/// </summary>
Stop = 7,
/// <summary>
/// A user is requesting a seek command for the group.
/// </summary>
Seek = 2,
Seek = 8,
/// <summary>
/// <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 reporting its ping.
/// A user is requesting next track in playlist.
/// </summary>
Ping = 5
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 requesting to be ignored on group wait.
/// </summary>
IgnoreWait = 16
}
}

View File

@@ -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; }
}
}

View File

@@ -13,6 +13,12 @@ namespace MediaBrowser.Model.SyncPlay
/// <value>The group identifier.</value>
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>

View File

@@ -6,18 +6,23 @@ 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.
/// </summary>
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
}
}