From f71812abc07bfe3784c4779d6e4fa8d87be7aa94 Mon Sep 17 00:00:00 2001 From: BaronGreenback Date: Sun, 20 Sep 2020 14:36:46 +0100 Subject: [PATCH] Update SessionController.cs --- Jellyfin.Api/Controllers/SessionController.cs | 23 +++++++++++-------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/Jellyfin.Api/Controllers/SessionController.cs b/Jellyfin.Api/Controllers/SessionController.cs index 3720e821f7..a7bddc1715 100644 --- a/Jellyfin.Api/Controllers/SessionController.cs +++ b/Jellyfin.Api/Controllers/SessionController.cs @@ -1,5 +1,3 @@ -#pragma warning disable CA1801 - using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -184,8 +182,9 @@ namespace Jellyfin.Api.Controllers /// Issues a playstate command to a client. /// /// The session id. - /// The . - /// The . + /// The . + /// The optional position ticks. + /// The optional controlling user id. /// Playstate command sent to session. /// A . [HttpPost("Sessions/{sessionId}/Playing/{command}")] @@ -193,13 +192,19 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult SendPlaystateCommand( [FromRoute, Required] string sessionId, - [FromRoute, Required] PlayCommand command, - [FromQuery] PlaystateRequest playstateRequest) + [FromRoute, Required] PlaystateCommand command, + [FromQuery] long? seekPositionTicks, + [FromQuery] string? controllingUserId) { _sessionManager.SendPlaystateCommand( RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id, sessionId, - playstateRequest, + new PlaystateRequest() + { + Command = command, + ControllingUserId = controllingUserId, + SeekPositionTicks = seekPositionTicks, + }, CancellationToken.None); return NoContent(); @@ -436,9 +441,9 @@ namespace Jellyfin.Api.Controllers [ProducesResponseType(StatusCodes.Status204NoContent)] public ActionResult ReportViewing( [FromQuery] string? sessionId, - [FromQuery] string? itemId) + [FromQuery, Required] string? itemId) { - string session = RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id; + string session = sessionId ?? RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id; _sessionManager.ReportNowViewingItem(session, itemId); return NoContent();