mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 23:58:57 +00:00
Patch data-races and minor changes in SyncPlay
This commit is contained in:
@@ -11,41 +11,48 @@ namespace MediaBrowser.Model.SyncPlay
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="GroupInfoDto"/> class.
|
||||
/// </summary>
|
||||
public GroupInfoDto()
|
||||
/// <param name="groupId">The group identifier.</param>
|
||||
/// <param name="groupName">The group name.</param>
|
||||
/// <param name="state">The group state.</param>
|
||||
/// <param name="participants">The participants.</param>
|
||||
/// <param name="lastUpdatedAt">The date when this DTO has been created.</param>
|
||||
public GroupInfoDto(Guid groupId, string groupName, GroupStateType state, IReadOnlyList<string> participants, DateTime lastUpdatedAt)
|
||||
{
|
||||
GroupId = string.Empty;
|
||||
GroupName = string.Empty;
|
||||
Participants = new List<string>();
|
||||
GroupId = groupId;
|
||||
GroupName = groupName;
|
||||
State = state;
|
||||
Participants = participants;
|
||||
LastUpdatedAt = lastUpdatedAt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the group identifier.
|
||||
/// Gets the group identifier.
|
||||
/// </summary>
|
||||
/// <value>The group identifier.</value>
|
||||
public string GroupId { get; set; }
|
||||
public Guid GroupId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the group name.
|
||||
/// Gets the group name.
|
||||
/// </summary>
|
||||
/// <value>The group name.</value>
|
||||
public string GroupName { get; set; }
|
||||
public string GroupName { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the group state.
|
||||
/// Gets the group state.
|
||||
/// </summary>
|
||||
/// <value>The group state.</value>
|
||||
public GroupStateType State { get; set; }
|
||||
public GroupStateType State { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the participants.
|
||||
/// Gets the participants.
|
||||
/// </summary>
|
||||
/// <value>The participants.</value>
|
||||
public IReadOnlyList<string> Participants { get; set; }
|
||||
public IReadOnlyList<string> Participants { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the date when this dto has been updated.
|
||||
/// Gets the date when this DTO has been created.
|
||||
/// </summary>
|
||||
/// <value>The date when this dto has been updated.</value>
|
||||
public DateTime LastUpdatedAt { get; set; }
|
||||
/// <value>The date when this DTO has been created.</value>
|
||||
public DateTime LastUpdatedAt { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,15 +6,26 @@ namespace MediaBrowser.Model.SyncPlay
|
||||
public class GroupStateUpdate
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the state of the group.
|
||||
/// Initializes a new instance of the <see cref="GroupStateUpdate"/> class.
|
||||
/// </summary>
|
||||
/// <value>The state of the group.</value>
|
||||
public GroupStateType State { get; set; }
|
||||
/// <param name="state">The state of the group.</param>
|
||||
/// <param name="reason">The reason of the state change.</param>
|
||||
public GroupStateUpdate(GroupStateType state, PlaybackRequestType reason)
|
||||
{
|
||||
State = state;
|
||||
Reason = reason;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reason of the state change.
|
||||
/// Gets the state of the group.
|
||||
/// </summary>
|
||||
/// <value>The state of the group.</value>
|
||||
public GroupStateType State { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the reason of the state change.
|
||||
/// </summary>
|
||||
/// <value>The reason of the state change.</value>
|
||||
public PlaybackRequestType Reason { get; set; }
|
||||
public PlaybackRequestType Reason { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.SyncPlay
|
||||
{
|
||||
@@ -9,21 +9,34 @@ namespace MediaBrowser.Model.SyncPlay
|
||||
public class GroupUpdate<T>
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the group identifier.
|
||||
/// Initializes a new instance of the <see cref="GroupUpdate{T}"/> class.
|
||||
/// </summary>
|
||||
/// <param name="groupId">The group identifier.</param>
|
||||
/// <param name="type">The update type.</param>
|
||||
/// <param name="data">The update data.</param>
|
||||
public GroupUpdate(Guid groupId, GroupUpdateType type, T data)
|
||||
{
|
||||
GroupId = groupId;
|
||||
Type = type;
|
||||
Data = data;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the group identifier.
|
||||
/// </summary>
|
||||
/// <value>The group identifier.</value>
|
||||
public string GroupId { get; set; }
|
||||
public Guid GroupId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the update type.
|
||||
/// Gets the update type.
|
||||
/// </summary>
|
||||
/// <value>The update type.</value>
|
||||
public GroupUpdateType Type { get; set; }
|
||||
public GroupUpdateType Type { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the data.
|
||||
/// Gets the update data.
|
||||
/// </summary>
|
||||
/// <value>The data.</value>
|
||||
public T Data { get; set; }
|
||||
/// <value>The update data.</value>
|
||||
public T Data { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,9 +8,18 @@ namespace MediaBrowser.Model.SyncPlay
|
||||
public class JoinGroupRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the group identifier.
|
||||
/// Initializes a new instance of the <see cref="JoinGroupRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="groupId">The identifier of the group to join.</param>
|
||||
public JoinGroupRequest(Guid groupId)
|
||||
{
|
||||
GroupId = groupId;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the group identifier.
|
||||
/// </summary>
|
||||
/// <value>The identifier of the group to join.</value>
|
||||
public Guid GroupId { get; set; }
|
||||
public Guid GroupId { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,15 +8,16 @@ namespace MediaBrowser.Model.SyncPlay
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NewGroupRequest"/> class.
|
||||
/// </summary>
|
||||
public NewGroupRequest()
|
||||
/// <param name="groupName">The name of the new group.</param>
|
||||
public NewGroupRequest(string groupName)
|
||||
{
|
||||
GroupName = string.Empty;
|
||||
GroupName = groupName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the group name.
|
||||
/// Gets the group name.
|
||||
/// </summary>
|
||||
/// <value>The name of the new group.</value>
|
||||
public string GroupName { get; set; }
|
||||
public string GroupName { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,51 +11,64 @@ namespace MediaBrowser.Model.SyncPlay
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PlayQueueUpdate"/> class.
|
||||
/// </summary>
|
||||
public PlayQueueUpdate()
|
||||
/// <param name="reason">The reason for the update.</param>
|
||||
/// <param name="lastUpdate">The UTC time of the last change to the playing queue.</param>
|
||||
/// <param name="playlist">The playlist.</param>
|
||||
/// <param name="playingItemIndex">The playing item index in the playlist.</param>
|
||||
/// <param name="startPositionTicks">The start position ticks.</param>
|
||||
/// <param name="shuffleMode">The shuffle mode.</param>
|
||||
/// <param name="repeatMode">The repeat mode.</param>
|
||||
public PlayQueueUpdate(PlayQueueUpdateReason reason, DateTime lastUpdate, IReadOnlyList<QueueItem> playlist, int playingItemIndex, long startPositionTicks, GroupShuffleMode shuffleMode, GroupRepeatMode repeatMode)
|
||||
{
|
||||
Playlist = new List<QueueItem>();
|
||||
Reason = reason;
|
||||
LastUpdate = lastUpdate;
|
||||
Playlist = playlist;
|
||||
PlayingItemIndex = playingItemIndex;
|
||||
StartPositionTicks = startPositionTicks;
|
||||
ShuffleMode = shuffleMode;
|
||||
RepeatMode = repeatMode;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the request type that originated this update.
|
||||
/// Gets the request type that originated this update.
|
||||
/// </summary>
|
||||
/// <value>The reason for the update.</value>
|
||||
public PlayQueueUpdateReason Reason { get; set; }
|
||||
public PlayQueueUpdateReason Reason { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UTC time of the last change to the playing queue.
|
||||
/// Gets 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 DateTime LastUpdate { get; set; }
|
||||
public DateTime LastUpdate { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the playlist.
|
||||
/// Gets the playlist.
|
||||
/// </summary>
|
||||
/// <value>The playlist.</value>
|
||||
public IReadOnlyList<QueueItem> Playlist { get; set; }
|
||||
public IReadOnlyList<QueueItem> Playlist { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the playing item index in the playlist.
|
||||
/// Gets the playing item index in the playlist.
|
||||
/// </summary>
|
||||
/// <value>The playing item index in the playlist.</value>
|
||||
public int PlayingItemIndex { get; set; }
|
||||
public int PlayingItemIndex { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the start position ticks.
|
||||
/// Gets the start position ticks.
|
||||
/// </summary>
|
||||
/// <value>The start position ticks.</value>
|
||||
public long StartPositionTicks { get; set; }
|
||||
public long StartPositionTicks { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the shuffle mode.
|
||||
/// Gets the shuffle mode.
|
||||
/// </summary>
|
||||
/// <value>The shuffle mode.</value>
|
||||
public GroupShuffleMode ShuffleMode { get; set; }
|
||||
public GroupShuffleMode ShuffleMode { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the repeat mode.
|
||||
/// Gets the repeat mode.
|
||||
/// </summary>
|
||||
/// <value>The repeat mode.</value>
|
||||
public GroupRepeatMode RepeatMode { get; set; }
|
||||
public GroupRepeatMode RepeatMode { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,23 +10,33 @@ namespace MediaBrowser.Model.SyncPlay
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SendCommand"/> class.
|
||||
/// </summary>
|
||||
public SendCommand()
|
||||
/// <param name="groupId">The group identifier.</param>
|
||||
/// <param name="playlistItemId">The playlist identifier of the playing item.</param>
|
||||
/// <param name="when">The UTC time when to execute the command.</param>
|
||||
/// <param name="command">The command.</param>
|
||||
/// <param name="positionTicks">The position ticks, for commands that require it.</param>
|
||||
/// <param name="emittedAt">The UTC time when this command has been emitted.</param>
|
||||
public SendCommand(Guid groupId, string playlistItemId, DateTime when, SendCommandType command, long? positionTicks, DateTime emittedAt)
|
||||
{
|
||||
GroupId = string.Empty;
|
||||
PlaylistItemId = string.Empty;
|
||||
GroupId = groupId;
|
||||
PlaylistItemId = playlistItemId;
|
||||
When = when;
|
||||
Command = command;
|
||||
PositionTicks = positionTicks;
|
||||
EmittedAt = emittedAt;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the group identifier.
|
||||
/// Gets the group identifier.
|
||||
/// </summary>
|
||||
/// <value>The group identifier.</value>
|
||||
public string GroupId { get; set; }
|
||||
public Guid GroupId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the playlist identifier of the playing item.
|
||||
/// Gets the playlist identifier of the playing item.
|
||||
/// </summary>
|
||||
/// <value>The playlist identifier of the playing item.</value>
|
||||
public string PlaylistItemId { get; set; }
|
||||
public string PlaylistItemId { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UTC time when to execute the command.
|
||||
@@ -35,21 +45,21 @@ namespace MediaBrowser.Model.SyncPlay
|
||||
public DateTime When { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the position ticks.
|
||||
/// Gets the position ticks.
|
||||
/// </summary>
|
||||
/// <value>The position ticks.</value>
|
||||
public long? PositionTicks { get; set; }
|
||||
public long? PositionTicks { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the command.
|
||||
/// Gets the command.
|
||||
/// </summary>
|
||||
/// <value>The command.</value>
|
||||
public SendCommandType Command { get; set; }
|
||||
public SendCommandType Command { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UTC time when this command has been emitted.
|
||||
/// Gets the UTC time when this command has been emitted.
|
||||
/// </summary>
|
||||
/// <value>The UTC time when this command has been emitted.</value>
|
||||
public DateTime EmittedAt { get; set; }
|
||||
public DateTime EmittedAt { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#nullable disable
|
||||
using System;
|
||||
|
||||
namespace MediaBrowser.Model.SyncPlay
|
||||
{
|
||||
@@ -8,15 +8,26 @@ namespace MediaBrowser.Model.SyncPlay
|
||||
public class UtcTimeResponse
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the UTC time when request has been received.
|
||||
/// Initializes a new instance of the <see cref="UtcTimeResponse"/> class.
|
||||
/// </summary>
|
||||
/// <value>The UTC time when request has been received.</value>
|
||||
public string RequestReceptionTime { get; set; }
|
||||
/// <param name="requestReceptionTime">The UTC time when request has been received.</param>
|
||||
/// <param name="responseTransmissionTime">The UTC time when response has been sent.</param>
|
||||
public UtcTimeResponse(DateTime requestReceptionTime, DateTime responseTransmissionTime)
|
||||
{
|
||||
RequestReceptionTime = requestReceptionTime;
|
||||
ResponseTransmissionTime = responseTransmissionTime;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the UTC time when response has been sent.
|
||||
/// Gets the UTC time when request has been received.
|
||||
/// </summary>
|
||||
/// <value>The UTC time when request has been received.</value>
|
||||
public DateTime RequestReceptionTime { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the UTC time when response has been sent.
|
||||
/// </summary>
|
||||
/// <value>The UTC time when response has been sent.</value>
|
||||
public string ResponseTransmissionTime { get; set; }
|
||||
public DateTime ResponseTransmissionTime { get; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user