mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-01 05:18:27 +01:00
Create common interface for SyncPlay requests
This commit is contained in:
@@ -209,14 +209,14 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
|
||||
protected void SendGroupStateUpdate(IGroupStateContext context, IGroupPlaybackRequest reason, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
// Notify relevant state change event.
|
||||
var stateUpdate = new GroupStateUpdate(Type, reason.Type);
|
||||
var stateUpdate = new GroupStateUpdate(Type, reason.Action);
|
||||
var update = context.NewSyncPlayGroupUpdate(GroupUpdateType.StateUpdate, stateUpdate);
|
||||
context.SendGroupUpdate(session, SyncPlayBroadcastType.AllGroup, update, cancellationToken);
|
||||
}
|
||||
|
||||
private void UnhandledRequest(IGroupPlaybackRequest request)
|
||||
{
|
||||
_logger.LogWarning("Unhandled request of type {RequestType} in {StateType} state.", request.Type, Type);
|
||||
_logger.LogWarning("Unhandled request of type {RequestType} in {StateType} state.", request.Action, Type);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,8 +3,8 @@ using System.Threading;
|
||||
using Jellyfin.Data.Entities;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Controller.SyncPlay.Queue;
|
||||
using MediaBrowser.Controller.SyncPlay.Requests;
|
||||
using MediaBrowser.Model.SyncPlay;
|
||||
using MediaBrowser.Model.SyncPlay.RequestBodies;
|
||||
|
||||
namespace MediaBrowser.Controller.SyncPlay
|
||||
{
|
||||
@@ -37,7 +37,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <param name="session">The session.</param>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void CreateGroup(SessionInfo session, NewGroupRequestBody request, CancellationToken cancellationToken);
|
||||
void CreateGroup(SessionInfo session, NewGroupRequest request, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the session to the group.
|
||||
@@ -45,7 +45,7 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <param name="session">The session.</param>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void SessionJoin(SessionInfo session, JoinGroupRequestBody request, CancellationToken cancellationToken);
|
||||
void SessionJoin(SessionInfo session, JoinGroupRequest request, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Restores the state of a session that already joined the group.
|
||||
@@ -53,14 +53,15 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <param name="session">The session.</param>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void SessionRestore(SessionInfo session, JoinGroupRequestBody request, CancellationToken cancellationToken);
|
||||
void SessionRestore(SessionInfo session, JoinGroupRequest request, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the session from the group.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void SessionLeave(SessionInfo session, CancellationToken cancellationToken);
|
||||
void SessionLeave(SessionInfo session, LeaveGroupRequest request, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Handles the requested action by the session.
|
||||
|
||||
@@ -7,13 +7,13 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <summary>
|
||||
/// Interface IGroupPlaybackRequest.
|
||||
/// </summary>
|
||||
public interface IGroupPlaybackRequest
|
||||
public interface IGroupPlaybackRequest : ISyncPlayRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the playback request type.
|
||||
/// </summary>
|
||||
/// <returns>The playback request type.</returns>
|
||||
PlaybackRequestType Type { get; }
|
||||
PlaybackRequestType Action { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Applies the request to a group.
|
||||
|
||||
@@ -2,6 +2,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Controller.SyncPlay.Requests;
|
||||
using MediaBrowser.Model.SyncPlay;
|
||||
using MediaBrowser.Model.SyncPlay.RequestBodies;
|
||||
|
||||
@@ -18,30 +19,31 @@ namespace MediaBrowser.Controller.SyncPlay
|
||||
/// <param name="session">The session that's creating the group.</param>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void NewGroup(SessionInfo session, NewGroupRequestBody request, CancellationToken cancellationToken);
|
||||
void NewGroup(SessionInfo session, NewGroupRequest request, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Adds the session to a group.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <param name="groupId">The group identifier.</param>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void JoinGroup(SessionInfo session, Guid groupId, JoinGroupRequestBody request, CancellationToken cancellationToken);
|
||||
void JoinGroup(SessionInfo session, JoinGroupRequest request, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the session from a group.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <param name="cancellationToken">The cancellation token.</param>
|
||||
void LeaveGroup(SessionInfo session, CancellationToken cancellationToken);
|
||||
void LeaveGroup(SessionInfo session, LeaveGroupRequest request, CancellationToken cancellationToken);
|
||||
|
||||
/// <summary>
|
||||
/// Gets list of available groups for a session.
|
||||
/// </summary>
|
||||
/// <param name="session">The session.</param>
|
||||
/// <param name="request">The request.</param>
|
||||
/// <returns>The list of available groups.</returns>
|
||||
List<GroupInfoDto> ListGroups(SessionInfo session);
|
||||
List<GroupInfoDto> ListGroups(SessionInfo session, ListGroupsRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Handle a request by a session in a group.
|
||||
|
||||
16
MediaBrowser.Controller/SyncPlay/ISyncPlayRequest.cs
Normal file
16
MediaBrowser.Controller/SyncPlay/ISyncPlayRequest.cs
Normal file
@@ -0,0 +1,16 @@
|
||||
using MediaBrowser.Model.SyncPlay;
|
||||
|
||||
namespace MediaBrowser.Controller.SyncPlay
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface ISyncPlayRequest.
|
||||
/// </summary>
|
||||
public interface ISyncPlayRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the request type.
|
||||
/// </summary>
|
||||
/// <returns>The request type.</returns>
|
||||
RequestType Type { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
using System.Threading;
|
||||
using MediaBrowser.Controller.Session;
|
||||
using MediaBrowser.Model.SyncPlay;
|
||||
|
||||
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
{
|
||||
/// <summary>
|
||||
/// Class AbstractPlaybackRequest.
|
||||
/// </summary>
|
||||
public abstract class AbstractPlaybackRequest : IGroupPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="AbstractPlaybackRequest"/> class.
|
||||
/// </summary>
|
||||
protected AbstractPlaybackRequest()
|
||||
{
|
||||
// Do nothing.
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public RequestType Type { get; } = RequestType.Playback;
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract PlaybackRequestType Action { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken);
|
||||
}
|
||||
}
|
||||
@@ -8,7 +8,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class BufferGroupRequest.
|
||||
/// </summary>
|
||||
public class BufferGroupRequest : IGroupPlaybackRequest
|
||||
public class BufferGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BufferGroupRequest"/> class.
|
||||
@@ -50,10 +50,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public string PlaylistItemId { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.Buffer;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Buffer;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class IgnoreWaitGroupRequest.
|
||||
/// </summary>
|
||||
public class IgnoreWaitGroupRequest : IGroupPlaybackRequest
|
||||
public class IgnoreWaitGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="IgnoreWaitGroupRequest"/> class.
|
||||
@@ -25,10 +25,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public bool IgnoreWait { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.IgnoreWait;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.IgnoreWait;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class MovePlaylistItemGroupRequest.
|
||||
/// </summary>
|
||||
public class MovePlaylistItemGroupRequest : IGroupPlaybackRequest
|
||||
public class MovePlaylistItemGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="MovePlaylistItemGroupRequest"/> class.
|
||||
@@ -33,10 +33,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public int NewIndex { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.MovePlaylistItem;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.MovePlaylistItem;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class NextTrackGroupRequest.
|
||||
/// </summary>
|
||||
public class NextTrackGroupRequest : IGroupPlaybackRequest
|
||||
public class NextTrackGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NextTrackGroupRequest"/> class.
|
||||
@@ -25,10 +25,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public string PlaylistItemId { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.NextTrack;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.NextTrack;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class PauseGroupRequest.
|
||||
/// </summary>
|
||||
public class PauseGroupRequest : IGroupPlaybackRequest
|
||||
public class PauseGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.Pause;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Pause;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class PingGroupRequest.
|
||||
/// </summary>
|
||||
public class PingGroupRequest : IGroupPlaybackRequest
|
||||
public class PingGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PingGroupRequest"/> class.
|
||||
@@ -25,10 +25,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public long Ping { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.Ping;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Ping;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class PlayGroupRequest.
|
||||
/// </summary>
|
||||
public class PlayGroupRequest : IGroupPlaybackRequest
|
||||
public class PlayGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PlayGroupRequest"/> class.
|
||||
@@ -43,10 +43,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public long StartPositionTicks { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.Play;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Play;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class PreviousTrackGroupRequest.
|
||||
/// </summary>
|
||||
public class PreviousTrackGroupRequest : IGroupPlaybackRequest
|
||||
public class PreviousTrackGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="PreviousTrackGroupRequest"/> class.
|
||||
@@ -25,10 +25,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public string PlaylistItemId { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.PreviousTrack;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.PreviousTrack;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class QueueGroupRequest.
|
||||
/// </summary>
|
||||
public class QueueGroupRequest : IGroupPlaybackRequest
|
||||
public class QueueGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="QueueGroupRequest"/> class.
|
||||
@@ -35,10 +35,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public GroupQueueMode Mode { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.Queue;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Queue;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class ReadyGroupRequest.
|
||||
/// </summary>
|
||||
public class ReadyGroupRequest : IGroupPlaybackRequest
|
||||
public class ReadyGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="ReadyGroupRequest"/> class.
|
||||
@@ -50,10 +50,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public string PlaylistItemId { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.Ready;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Ready;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class RemoveFromPlaylistGroupRequest.
|
||||
/// </summary>
|
||||
public class RemoveFromPlaylistGroupRequest : IGroupPlaybackRequest
|
||||
public class RemoveFromPlaylistGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="RemoveFromPlaylistGroupRequest"/> class.
|
||||
@@ -27,10 +27,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public IReadOnlyList<string> PlaylistItemIds { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.RemoveFromPlaylist;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.RemoveFromPlaylist;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class SeekGroupRequest.
|
||||
/// </summary>
|
||||
public class SeekGroupRequest : IGroupPlaybackRequest
|
||||
public class SeekGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SeekGroupRequest"/> class.
|
||||
@@ -25,10 +25,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public long PositionTicks { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.Seek;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Seek;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class SetPlaylistItemGroupRequest.
|
||||
/// </summary>
|
||||
public class SetPlaylistItemGroupRequest : IGroupPlaybackRequest
|
||||
public class SetPlaylistItemGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SetPlaylistItemGroupRequest"/> class.
|
||||
@@ -25,10 +25,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public string PlaylistItemId { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.SetPlaylistItem;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.SetPlaylistItem;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class SetRepeatModeGroupRequest.
|
||||
/// </summary>
|
||||
public class SetRepeatModeGroupRequest : IGroupPlaybackRequest
|
||||
public class SetRepeatModeGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SetRepeatModeGroupRequest"/> class.
|
||||
@@ -25,10 +25,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public GroupRepeatMode Mode { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.SetRepeatMode;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.SetRepeatMode;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class SetShuffleModeGroupRequest.
|
||||
/// </summary>
|
||||
public class SetShuffleModeGroupRequest : IGroupPlaybackRequest
|
||||
public class SetShuffleModeGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="SetShuffleModeGroupRequest"/> class.
|
||||
@@ -25,10 +25,10 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
public GroupShuffleMode Mode { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.SetShuffleMode;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.SetShuffleMode;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class StopGroupRequest.
|
||||
/// </summary>
|
||||
public class StopGroupRequest : IGroupPlaybackRequest
|
||||
public class StopGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.Stop;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Stop;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -7,13 +7,13 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
|
||||
/// <summary>
|
||||
/// Class UnpauseGroupRequest.
|
||||
/// </summary>
|
||||
public class UnpauseGroupRequest : IGroupPlaybackRequest
|
||||
public class UnpauseGroupRequest : AbstractPlaybackRequest
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public PlaybackRequestType Type { get; } = PlaybackRequestType.Unpause;
|
||||
public override PlaybackRequestType Action { get; } = PlaybackRequestType.Unpause;
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)
|
||||
{
|
||||
state.HandleRequest(context, state.Type, this, session, cancellationToken);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using MediaBrowser.Model.SyncPlay;
|
||||
|
||||
namespace MediaBrowser.Controller.SyncPlay.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// Class JoinGroupRequest.
|
||||
/// </summary>
|
||||
public class JoinGroupRequest : ISyncPlayRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// 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; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public RequestType Type { get; } = RequestType.JoinGroup;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using MediaBrowser.Model.SyncPlay;
|
||||
|
||||
namespace MediaBrowser.Controller.SyncPlay.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// Class LeaveGroupRequest.
|
||||
/// </summary>
|
||||
public class LeaveGroupRequest : ISyncPlayRequest
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public RequestType Type { get; } = RequestType.LeaveGroup;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using MediaBrowser.Model.SyncPlay;
|
||||
|
||||
namespace MediaBrowser.Controller.SyncPlay.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// Class ListGroupsRequest.
|
||||
/// </summary>
|
||||
public class ListGroupsRequest : ISyncPlayRequest
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public RequestType Type { get; } = RequestType.ListGroups;
|
||||
}
|
||||
}
|
||||
28
MediaBrowser.Controller/SyncPlay/Requests/NewGroupRequest.cs
Normal file
28
MediaBrowser.Controller/SyncPlay/Requests/NewGroupRequest.cs
Normal file
@@ -0,0 +1,28 @@
|
||||
using MediaBrowser.Model.SyncPlay;
|
||||
|
||||
namespace MediaBrowser.Controller.SyncPlay.Requests
|
||||
{
|
||||
/// <summary>
|
||||
/// Class NewGroupRequest.
|
||||
/// </summary>
|
||||
public class NewGroupRequest : ISyncPlayRequest
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="NewGroupRequest"/> class.
|
||||
/// </summary>
|
||||
/// <param name="groupName">The name of the new group.</param>
|
||||
public NewGroupRequest(string groupName)
|
||||
{
|
||||
GroupName = groupName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the group name.
|
||||
/// </summary>
|
||||
/// <value>The name of the new group.</value>
|
||||
public string GroupName { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public RequestType Type { get; } = RequestType.NewGroup;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user