Update SessionController.cs

This commit is contained in:
BaronGreenback 2020-09-20 14:36:46 +01:00 committed by GitHub
parent d6f01d6503
commit f71812abc0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,5 +1,3 @@
#pragma warning disable CA1801
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
@ -184,8 +182,9 @@ namespace Jellyfin.Api.Controllers
/// Issues a playstate command to a client. /// Issues a playstate command to a client.
/// </summary> /// </summary>
/// <param name="sessionId">The session id.</param> /// <param name="sessionId">The session id.</param>
/// <param name="command">The <see cref="PlayCommand"/>.</param> /// <param name="command">The <see cref="PlaystateCommand"/>.</param>
/// <param name="playstateRequest">The <see cref="PlaystateRequest"/>.</param> /// <param name="seekPositionTicks">The optional position ticks.</param>
/// <param name="controllingUserId">The optional controlling user id.</param>
/// <response code="204">Playstate command sent to session.</response> /// <response code="204">Playstate command sent to session.</response>
/// <returns>A <see cref="NoContentResult"/>.</returns> /// <returns>A <see cref="NoContentResult"/>.</returns>
[HttpPost("Sessions/{sessionId}/Playing/{command}")] [HttpPost("Sessions/{sessionId}/Playing/{command}")]
@ -193,13 +192,19 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult SendPlaystateCommand( public ActionResult SendPlaystateCommand(
[FromRoute, Required] string sessionId, [FromRoute, Required] string sessionId,
[FromRoute, Required] PlayCommand command, [FromRoute, Required] PlaystateCommand command,
[FromQuery] PlaystateRequest playstateRequest) [FromQuery] long? seekPositionTicks,
[FromQuery] string? controllingUserId)
{ {
_sessionManager.SendPlaystateCommand( _sessionManager.SendPlaystateCommand(
RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id, RequestHelpers.GetSession(_sessionManager, _authContext, Request).Id,
sessionId, sessionId,
playstateRequest, new PlaystateRequest()
{
Command = command,
ControllingUserId = controllingUserId,
SeekPositionTicks = seekPositionTicks,
},
CancellationToken.None); CancellationToken.None);
return NoContent(); return NoContent();
@ -436,9 +441,9 @@ namespace Jellyfin.Api.Controllers
[ProducesResponseType(StatusCodes.Status204NoContent)] [ProducesResponseType(StatusCodes.Status204NoContent)]
public ActionResult ReportViewing( public ActionResult ReportViewing(
[FromQuery] string? sessionId, [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); _sessionManager.ReportNowViewingItem(session, itemId);
return NoContent(); return NoContent();