Hide some property setters, init null values, update namespaces

This commit is contained in:
Ionut Andrei Oanca
2020-11-14 23:40:01 +01:00
parent fa69f6fd51
commit 5d77f422f0
37 changed files with 365 additions and 229 deletions

View File

@@ -3,7 +3,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class BufferGroupRequest.
@@ -11,28 +11,43 @@ namespace MediaBrowser.Controller.SyncPlay
public class BufferGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets when the request has been made by the client.
/// Initializes a new instance of the <see cref="BufferGroupRequest"/> class.
/// </summary>
/// <param name="when">When the request has been made, as reported by the client.</param>
/// <param name="positionTicks">The position ticks.</param>
/// <param name="isPlaying">Whether the client playback is unpaused.</param>
/// <param name="playlistItemId">The playlist item identifier of the playing item.</param>
public BufferGroupRequest(DateTime when, long positionTicks, bool isPlaying, string playlistItemId)
{
When = when;
PositionTicks = positionTicks;
IsPlaying = isPlaying;
PlaylistItemId = playlistItemId;
}
/// <summary>
/// Gets when the request has been made by the client.
/// </summary>
/// <value>The date of the request.</value>
public DateTime When { get; set; }
public DateTime When { get; }
/// <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 a value indicating whether the client playback is unpaused.
/// Gets a value indicating whether the client playback is unpaused.
/// </summary>
/// <value>The client playback status.</value>
public bool IsPlaying { get; set; }
public bool IsPlaying { get; }
/// <summary>
/// Gets or sets the playlist item identifier of the playing item.
/// Gets the playlist item identifier of the playing item.
/// </summary>
/// <value>The playlist item identifier.</value>
public string PlaylistItemId { get; set; }
public string PlaylistItemId { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.Buffer;

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class IgnoreWaitGroupRequest.
@@ -10,10 +10,19 @@ namespace MediaBrowser.Controller.SyncPlay
public class IgnoreWaitGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets a value indicating whether the client should be ignored.
/// Initializes a new instance of the <see cref="IgnoreWaitGroupRequest"/> class.
/// </summary>
/// <param name="ignoreWait">Whether the client should be ignored.</param>
public IgnoreWaitGroupRequest(bool ignoreWait)
{
IgnoreWait = ignoreWait;
}
/// <summary>
/// Gets a value indicating whether the client should be ignored.
/// </summary>
/// <value>The client group-wait status.</value>
public bool IgnoreWait { get; set; }
public bool IgnoreWait { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.IgnoreWait;

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class MovePlaylistItemGroupRequest.
@@ -10,16 +10,27 @@ namespace MediaBrowser.Controller.SyncPlay
public class MovePlaylistItemGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets the playlist identifier of the item.
/// Initializes a new instance of the <see cref="MovePlaylistItemGroupRequest"/> class.
/// </summary>
/// <value>The playlist identifier of the item.</value>
public string PlaylistItemId { get; set; }
/// <param name="playlistItemId">The playlist identifier of the item.</param>
/// <param name="newIndex">The new position.</param>
public MovePlaylistItemGroupRequest(string playlistItemId, int newIndex)
{
PlaylistItemId = playlistItemId;
NewIndex = newIndex;
}
/// <summary>
/// Gets or sets the new position.
/// Gets the playlist identifier of the item.
/// </summary>
/// <value>The playlist identifier of the item.</value>
public string PlaylistItemId { get; }
/// <summary>
/// Gets the new position.
/// </summary>
/// <value>The new position.</value>
public int NewIndex { get; set; }
public int NewIndex { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.MovePlaylistItem;

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class NextTrackGroupRequest.
@@ -10,10 +10,19 @@ namespace MediaBrowser.Controller.SyncPlay
public class NextTrackGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets the playing item identifier.
/// Initializes a new instance of the <see cref="NextTrackGroupRequest"/> class.
/// </summary>
/// <param name="playlistItemId">The playing item identifier.</param>
public NextTrackGroupRequest(string playlistItemId)
{
PlaylistItemId = playlistItemId;
}
/// <summary>
/// Gets the playing item identifier.
/// </summary>
/// <value>The playing item identifier.</value>
public string PlaylistItemId { get; set; }
public string PlaylistItemId { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.NextTrack;

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class PauseGroupRequest.

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class PingGroupRequest.
@@ -10,10 +10,19 @@ namespace MediaBrowser.Controller.SyncPlay
public class PingGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets the ping time.
/// Initializes a new instance of the <see cref="PingGroupRequest"/> class.
/// </summary>
/// <param name="ping">The ping time.</param>
public PingGroupRequest(long ping)
{
Ping = ping;
}
/// <summary>
/// Gets the ping time.
/// </summary>
/// <value>The ping time.</value>
public long Ping { get; set; }
public long Ping { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.Ping;

View File

@@ -4,30 +4,45 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class PlayGroupRequest.
/// </summary>
public class PlayGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="PlayGroupRequest"/> class.
/// </summary>
/// <param name="playingQueue">The playing queue.</param>
/// <param name="playingItemPosition">The playing item position.</param>
/// <param name="startPositionTicks">The start position ticks.</param>
public PlayGroupRequest(Guid[] playingQueue, int playingItemPosition, long startPositionTicks)
{
var list = new List<Guid>();
list.AddRange(playingQueue);
PlayingQueue = list;
PlayingItemPosition = playingItemPosition;
StartPositionTicks = startPositionTicks;
}
/// <summary>
/// Gets the playing queue.
/// </summary>
/// <value>The playing queue.</value>
public List<Guid> PlayingQueue { get; } = new List<Guid>();
public IReadOnlyList<Guid> PlayingQueue { get; }
/// <summary>
/// Gets or sets the playing item from the queue.
/// Gets the position of the playing item in the queue.
/// </summary>
/// <value>The playing item.</value>
public int PlayingItemPosition { get; set; }
/// <value>The playing item position.</value>
public int PlayingItemPosition { 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; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.Play;

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class PreviousTrackGroupRequest.
@@ -10,10 +10,19 @@ namespace MediaBrowser.Controller.SyncPlay
public class PreviousTrackGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets the playing item identifier.
/// Initializes a new instance of the <see cref="PreviousTrackGroupRequest"/> class.
/// </summary>
/// <param name="playlistItemId">The playing item identifier.</param>
public PreviousTrackGroupRequest(string playlistItemId)
{
PlaylistItemId = playlistItemId;
}
/// <summary>
/// Gets the playing item identifier.
/// </summary>
/// <value>The playing item identifier.</value>
public string PlaylistItemId { get; set; }
public string PlaylistItemId { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.PreviousTrack;

View File

@@ -4,7 +4,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class QueueGroupRequest.
@@ -12,16 +12,29 @@ namespace MediaBrowser.Controller.SyncPlay
public class QueueGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets the items to queue.
/// Initializes a new instance of the <see cref="QueueGroupRequest"/> class.
/// </summary>
/// <value>The items to queue.</value>
public List<Guid> ItemIds { get; } = new List<Guid>();
/// <param name="items">The items to add to the queue.</param>
/// <param name="mode">The enqueue mode.</param>
public QueueGroupRequest(Guid[] items, GroupQueueMode mode)
{
var list = new List<Guid>();
list.AddRange(items);
ItemIds = list;
Mode = mode;
}
/// <summary>
/// Gets or sets the mode in which to add the new items.
/// Gets the items to enqueue.
/// </summary>
/// <value>The mode.</value>
public string Mode { get; set; }
/// <value>The items to enqueue.</value>
public IReadOnlyList<Guid> ItemIds { get; }
/// <summary>
/// Gets the mode in which to add the new items.
/// </summary>
/// <value>The enqueue mode.</value>
public GroupQueueMode Mode { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.Queue;

View File

@@ -3,7 +3,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class ReadyGroupRequest.
@@ -11,28 +11,43 @@ namespace MediaBrowser.Controller.SyncPlay
public class ReadyGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets when the request has been made by the client.
/// Initializes a new instance of the <see cref="ReadyGroupRequest"/> class.
/// </summary>
/// <param name="when">When the request has been made, as reported by the client.</param>
/// <param name="positionTicks">The position ticks.</param>
/// <param name="isPlaying">Whether the client playback is unpaused.</param>
/// <param name="playlistItemId">The playlist item identifier of the playing item.</param>
public ReadyGroupRequest(DateTime when, long positionTicks, bool isPlaying, string playlistItemId)
{
When = when;
PositionTicks = positionTicks;
IsPlaying = isPlaying;
PlaylistItemId = playlistItemId;
}
/// <summary>
/// Gets when the request has been made by the client.
/// </summary>
/// <value>The date of the request.</value>
public DateTime When { get; set; }
public DateTime When { get; }
/// <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 a value indicating whether the client playback is unpaused.
/// Gets a value indicating whether the client playback is unpaused.
/// </summary>
/// <value>The client playback status.</value>
public bool IsPlaying { get; set; }
public bool IsPlaying { get; }
/// <summary>
/// Gets or sets the playlist item identifier of the playing item.
/// Gets the playlist item identifier of the playing item.
/// </summary>
/// <value>The playlist item identifier.</value>
public string PlaylistItemId { get; set; }
public string PlaylistItemId { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.Ready;

View File

@@ -3,18 +3,29 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class RemoveFromPlaylistGroupRequest.
/// </summary>
public class RemoveFromPlaylistGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="RemoveFromPlaylistGroupRequest"/> class.
/// </summary>
/// <param name="items">The playlist ids of the items to remove.</param>
public RemoveFromPlaylistGroupRequest(string[] items)
{
var list = new List<string>();
list.AddRange(items);
PlaylistItemIds = list;
}
/// <summary>
/// Gets the playlist identifiers ot the items.
/// </summary>
/// <value>The playlist identifiers ot the items.</value>
public List<string> PlaylistItemIds { get; } = new List<string>();
public IReadOnlyList<string> PlaylistItemIds { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.RemoveFromPlaylist;

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class SeekGroupRequest.
@@ -10,10 +10,19 @@ namespace MediaBrowser.Controller.SyncPlay
public class SeekGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets the position ticks.
/// Initializes a new instance of the <see cref="SeekGroupRequest"/> class.
/// </summary>
/// <param name="positionTicks">The position ticks.</param>
public SeekGroupRequest(long positionTicks)
{
PositionTicks = positionTicks;
}
/// <summary>
/// Gets the position ticks.
/// </summary>
/// <value>The position ticks.</value>
public long PositionTicks { get; set; }
public long PositionTicks { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.Seek;

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class SetPlaylistItemGroupRequest.
@@ -10,10 +10,19 @@ namespace MediaBrowser.Controller.SyncPlay
public class SetPlaylistItemGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets the playlist identifier of the playing item.
/// Initializes a new instance of the <see cref="SetPlaylistItemGroupRequest"/> class.
/// </summary>
/// <param name="playlistItemId">The playlist identifier of the item.</param>
public SetPlaylistItemGroupRequest(string playlistItemId)
{
PlaylistItemId = playlistItemId;
}
/// <summary>
/// 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; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.SetPlaylistItem;

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class SetRepeatModeGroupRequest.
@@ -10,10 +10,19 @@ namespace MediaBrowser.Controller.SyncPlay
public class SetRepeatModeGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets the repeat mode.
/// Initializes a new instance of the <see cref="SetRepeatModeGroupRequest"/> class.
/// </summary>
/// <param name="mode">The repeat mode.</param>
public SetRepeatModeGroupRequest(GroupRepeatMode mode)
{
Mode = mode;
}
/// <summary>
/// Gets the repeat mode.
/// </summary>
/// <value>The repeat mode.</value>
public string Mode { get; set; }
public GroupRepeatMode Mode { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.SetRepeatMode;

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class SetShuffleModeGroupRequest.
@@ -10,10 +10,19 @@ namespace MediaBrowser.Controller.SyncPlay
public class SetShuffleModeGroupRequest : IGroupPlaybackRequest
{
/// <summary>
/// Gets or sets the shuffle mode.
/// Initializes a new instance of the <see cref="SetShuffleModeGroupRequest"/> class.
/// </summary>
/// <param name="mode">The shuffle mode.</param>
public SetShuffleModeGroupRequest(GroupShuffleMode mode)
{
Mode = mode;
}
/// <summary>
/// Gets the shuffle mode.
/// </summary>
/// <value>The shuffle mode.</value>
public string Mode { get; set; }
public GroupShuffleMode Mode { get; }
/// <inheritdoc />
public PlaybackRequestType Type { get; } = PlaybackRequestType.SetShuffleMode;

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class StopGroupRequest.

View File

@@ -2,7 +2,7 @@ using System.Threading;
using MediaBrowser.Controller.Session;
using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class UnpauseGroupRequest.