Rename 'track' into 'item' in SyncPlay

This commit is contained in:
Ionut Andrei Oanca 2020-12-03 15:41:34 +01:00
parent 7e0ea296c3
commit 389367fec8
13 changed files with 70 additions and 70 deletions

View File

@ -108,14 +108,14 @@ namespace Jellyfin.Api.Controllers
}
/// <summary>
/// Request play in SyncPlay group.
/// Request to set new playlist in SyncPlay group.
/// </summary>
/// <param name="requestData">The new playlist to play in the group.</param>
/// <response code="204">Play request sent to all group members.</response>
/// <response code="204">Queue update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("Play")]
[HttpPost("SetNewQueue")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayPlay(
public ActionResult SyncPlaySetNewQueue(
[FromBody, Required] PlayRequestBody requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
@ -131,7 +131,7 @@ namespace Jellyfin.Api.Controllers
/// Request to change playlist item in SyncPlay group.
/// </summary>
/// <param name="requestData">The new item to play.</param>
/// <response code="204">Queue update request sent to all group members.</response>
/// <response code="204">Queue update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("SetPlaylistItem")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@ -148,7 +148,7 @@ namespace Jellyfin.Api.Controllers
/// Request to remove items from the playlist in SyncPlay group.
/// </summary>
/// <param name="requestData">The items to remove.</param>
/// <response code="204">Queue update request sent to all group members.</response>
/// <response code="204">Queue update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("RemoveFromPlaylist")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@ -165,7 +165,7 @@ namespace Jellyfin.Api.Controllers
/// Request to move an item in the playlist in SyncPlay group.
/// </summary>
/// <param name="requestData">The new position for the item.</param>
/// <response code="204">Queue update request sent to all group members.</response>
/// <response code="204">Queue update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("MovePlaylistItem")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@ -182,7 +182,7 @@ namespace Jellyfin.Api.Controllers
/// Request to queue items to the playlist of a SyncPlay group.
/// </summary>
/// <param name="requestData">The items to add.</param>
/// <response code="204">Queue update request sent to all group members.</response>
/// <response code="204">Queue update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("Queue")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@ -198,7 +198,7 @@ namespace Jellyfin.Api.Controllers
/// <summary>
/// Request unpause in SyncPlay group.
/// </summary>
/// <response code="204">Unpause request sent to all group members.</response>
/// <response code="204">Unpause update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("Unpause")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@ -213,7 +213,7 @@ namespace Jellyfin.Api.Controllers
/// <summary>
/// Request pause in SyncPlay group.
/// </summary>
/// <response code="204">Pause request sent to all group members.</response>
/// <response code="204">Pause update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("Pause")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@ -228,7 +228,7 @@ namespace Jellyfin.Api.Controllers
/// <summary>
/// Request stop in SyncPlay group.
/// </summary>
/// <response code="204">Stop request sent to all group members.</response>
/// <response code="204">Stop update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("Stop")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@ -244,7 +244,7 @@ namespace Jellyfin.Api.Controllers
/// Request seek in SyncPlay group.
/// </summary>
/// <param name="requestData">The new playback position.</param>
/// <response code="204">Seek request sent to all group members.</response>
/// <response code="204">Seek update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("Seek")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
@ -317,35 +317,35 @@ namespace Jellyfin.Api.Controllers
}
/// <summary>
/// Request next track in SyncPlay group.
/// Request next item in SyncPlay group.
/// </summary>
/// <param name="requestData">The current track information.</param>
/// <response code="204">Next track request sent to all group members.</response>
/// <param name="requestData">The current item information.</param>
/// <response code="204">Next item update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("NextTrack")]
[HttpPost("NextItem")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayNextTrack(
[FromBody, Required] NextTrackRequestBody requestData)
public ActionResult SyncPlayNextItem(
[FromBody, Required] NextItemRequestBody requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new NextTrackGroupRequest(requestData.PlaylistItemId);
var syncPlayRequest = new NextItemGroupRequest(requestData.PlaylistItemId);
_syncPlayManager.HandleRequest(currentSession, syncPlayRequest, CancellationToken.None);
return NoContent();
}
/// <summary>
/// Request previous track in SyncPlay group.
/// Request previous item in SyncPlay group.
/// </summary>
/// <param name="requestData">The current track information.</param>
/// <response code="204">Previous track request sent to all group members.</response>
/// <param name="requestData">The current item information.</param>
/// <response code="204">Previous item update sent to all group members.</response>
/// <returns>A <see cref="NoContentResult"/> indicating success.</returns>
[HttpPost("PreviousTrack")]
[HttpPost("PreviousItem")]
[ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SyncPlayPreviousTrack(
[FromBody, Required] PreviousTrackRequestBody requestData)
public ActionResult SyncPlayPreviousItem(
[FromBody, Required] PreviousItemRequestBody requestData)
{
var currentSession = RequestHelpers.GetSession(_sessionManager, _authorizationContext, Request);
var syncPlayRequest = new PreviousTrackGroupRequest(requestData.PlaylistItemId);
var syncPlayRequest = new PreviousItemGroupRequest(requestData.PlaylistItemId);
_syncPlayManager.HandleRequest(currentSession, syncPlayRequest, CancellationToken.None);
return NoContent();
}

View File

@ -157,13 +157,13 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
}
/// <inheritdoc />
public virtual void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
public virtual void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
{
UnhandledRequest(request);
}
/// <inheritdoc />
public virtual void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
public virtual void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
{
UnhandledRequest(request);
}

View File

@ -93,7 +93,7 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
}
/// <inheritdoc />
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
{
// Change state.
var waitingState = new WaitingGroupState(LoggerFactory);
@ -102,7 +102,7 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
}
/// <inheritdoc />
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
{
// Change state.
var waitingState = new WaitingGroupState(LoggerFactory);

View File

@ -145,7 +145,7 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
}
/// <inheritdoc />
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
{
// Change state.
var waitingState = new WaitingGroupState(LoggerFactory);
@ -154,7 +154,7 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
}
/// <inheritdoc />
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
{
// Change state.
var waitingState = new WaitingGroupState(LoggerFactory);

View File

@ -148,7 +148,7 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
}
/// <inheritdoc />
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
{
// Change state.
var waitingState = new WaitingGroupState(LoggerFactory);
@ -157,7 +157,7 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
}
/// <inheritdoc />
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
{
// Change state.
var waitingState = new WaitingGroupState(LoggerFactory);

View File

@ -560,7 +560,7 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
}
/// <inheritdoc />
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
{
// Save state if first event.
if (!InitialStateSet)
@ -582,7 +582,7 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
if (newItem)
{
// Send playing-queue update.
var playQueueUpdate = context.GetPlayQueueUpdate(PlayQueueUpdateReason.NextTrack);
var playQueueUpdate = context.GetPlayQueueUpdate(PlayQueueUpdateReason.NextItem);
var update = context.NewSyncPlayGroupUpdate(GroupUpdateType.PlayQueue, playQueueUpdate);
context.SendGroupUpdate(session, SyncPlayBroadcastType.AllGroup, update, cancellationToken);
@ -601,12 +601,12 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
context.SetState(newState);
_logger.LogDebug("No next track available in group {GroupId}.", context.GroupId.ToString());
_logger.LogDebug("No next item available in group {GroupId}.", context.GroupId.ToString());
}
}
/// <inheritdoc />
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
public override void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken)
{
// Save state if first event.
if (!InitialStateSet)
@ -628,7 +628,7 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
if (newItem)
{
// Send playing-queue update.
var playQueueUpdate = context.GetPlayQueueUpdate(PlayQueueUpdateReason.PreviousTrack);
var playQueueUpdate = context.GetPlayQueueUpdate(PlayQueueUpdateReason.PreviousItem);
var update = context.NewSyncPlayGroupUpdate(GroupUpdateType.PlayQueue, playQueueUpdate);
context.SendGroupUpdate(session, SyncPlayBroadcastType.AllGroup, update, cancellationToken);
@ -647,7 +647,7 @@ namespace MediaBrowser.Controller.SyncPlay.GroupStates
context.SetState(newState);
_logger.LogDebug("No previous track available in group {GroupId}.", context.GroupId.ToString());
_logger.LogDebug("No previous item available in group {GroupId}.", context.GroupId.ToString());
}
}

View File

@ -155,24 +155,24 @@ namespace MediaBrowser.Controller.SyncPlay
void HandleRequest(IGroupStateContext context, GroupStateType prevState, ReadyGroupRequest request, SessionInfo session, CancellationToken cancellationToken);
/// <summary>
/// Handles a next-track request from a session. Context's state can change.
/// Handles a next-item request from a session. Context's state can change.
/// </summary>
/// <param name="context">The context of the state.</param>
/// <param name="prevState">The previous state.</param>
/// <param name="request">The next-track request.</param>
/// <param name="request">The next-item request.</param>
/// <param name="session">The session.</param>
/// <param name="cancellationToken">The cancellation token.</param>
void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken);
void HandleRequest(IGroupStateContext context, GroupStateType prevState, NextItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken);
/// <summary>
/// Handles a previous-track request from a session. Context's state can change.
/// Handles a previous-item request from a session. Context's state can change.
/// </summary>
/// <param name="context">The context of the state.</param>
/// <param name="prevState">The previous state.</param>
/// <param name="request">The previous-track request.</param>
/// <param name="request">The previous-item request.</param>
/// <param name="session">The session.</param>
/// <param name="cancellationToken">The cancellation token.</param>
void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousTrackGroupRequest request, SessionInfo session, CancellationToken cancellationToken);
void HandleRequest(IGroupStateContext context, GroupStateType prevState, PreviousItemGroupRequest request, SessionInfo session, CancellationToken cancellationToken);
/// <summary>
/// Handles a set-repeat-mode request from a session. Context's state should not change.

View File

@ -5,15 +5,15 @@ using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class NextTrackGroupRequest.
/// Class NextItemGroupRequest.
/// </summary>
public class NextTrackGroupRequest : AbstractPlaybackRequest
public class NextItemGroupRequest : AbstractPlaybackRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="NextTrackGroupRequest"/> class.
/// Initializes a new instance of the <see cref="NextItemGroupRequest"/> class.
/// </summary>
/// <param name="playlistItemId">The playing item identifier.</param>
public NextTrackGroupRequest(string playlistItemId)
public NextItemGroupRequest(string playlistItemId)
{
PlaylistItemId = playlistItemId;
}
@ -25,7 +25,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
public string PlaylistItemId { get; }
/// <inheritdoc />
public override PlaybackRequestType Action { get; } = PlaybackRequestType.NextTrack;
public override PlaybackRequestType Action { get; } = PlaybackRequestType.NextItem;
/// <inheritdoc />
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)

View File

@ -5,15 +5,15 @@ using MediaBrowser.Model.SyncPlay;
namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
{
/// <summary>
/// Class PreviousTrackGroupRequest.
/// Class PreviousItemGroupRequest.
/// </summary>
public class PreviousTrackGroupRequest : AbstractPlaybackRequest
public class PreviousItemGroupRequest : AbstractPlaybackRequest
{
/// <summary>
/// Initializes a new instance of the <see cref="PreviousTrackGroupRequest"/> class.
/// Initializes a new instance of the <see cref="PreviousItemGroupRequest"/> class.
/// </summary>
/// <param name="playlistItemId">The playing item identifier.</param>
public PreviousTrackGroupRequest(string playlistItemId)
public PreviousItemGroupRequest(string playlistItemId)
{
PlaylistItemId = playlistItemId;
}
@ -25,7 +25,7 @@ namespace MediaBrowser.Controller.SyncPlay.PlaybackRequests
public string PlaylistItemId { get; }
/// <inheritdoc />
public override PlaybackRequestType Action { get; } = PlaybackRequestType.PreviousTrack;
public override PlaybackRequestType Action { get; } = PlaybackRequestType.PreviousItem;
/// <inheritdoc />
public override void Apply(IGroupStateContext context, IGroupState state, SessionInfo session, CancellationToken cancellationToken)

View File

@ -38,12 +38,12 @@ namespace MediaBrowser.Model.SyncPlay
/// <summary>
/// A user is requesting the next item in queue.
/// </summary>
NextTrack = 6,
NextItem = 6,
/// <summary>
/// A user is requesting the previous item in queue.
/// </summary>
PreviousTrack = 7,
PreviousItem = 7,
/// <summary>
/// A user is changing repeat mode.

View File

@ -61,14 +61,14 @@ namespace MediaBrowser.Model.SyncPlay
Ready = 10,
/// <summary>
/// A user is requesting next track in playlist.
/// A user is requesting next item in playlist.
/// </summary>
NextTrack = 11,
NextItem = 11,
/// <summary>
/// A user is requesting previous track in playlist.
/// A user is requesting previous item in playlist.
/// </summary>
PreviousTrack = 12,
PreviousItem = 12,
/// <summary>
/// A user is setting the repeat mode.

View File

@ -1,14 +1,14 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
{
/// <summary>
/// Class NextTrackRequestBody.
/// Class NextItemRequestBody.
/// </summary>
public class NextTrackRequestBody
public class NextItemRequestBody
{
/// <summary>
/// Initializes a new instance of the <see cref="NextTrackRequestBody"/> class.
/// Initializes a new instance of the <see cref="NextItemRequestBody"/> class.
/// </summary>
public NextTrackRequestBody()
public NextItemRequestBody()
{
PlaylistItemId = string.Empty;
}

View File

@ -1,14 +1,14 @@
namespace MediaBrowser.Model.SyncPlay.RequestBodies
{
/// <summary>
/// Class PreviousTrackRequestBody.
/// Class PreviousItemRequestBody.
/// </summary>
public class PreviousTrackRequestBody
public class PreviousItemRequestBody
{
/// <summary>
/// Initializes a new instance of the <see cref="PreviousTrackRequestBody"/> class.
/// Initializes a new instance of the <see cref="PreviousItemRequestBody"/> class.
/// </summary>
public PreviousTrackRequestBody()
public PreviousItemRequestBody()
{
PlaylistItemId = string.Empty;
}