|
|
|
@ -20,6 +20,7 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
/// Dlna Server Controller.
|
|
|
|
|
/// </summary>
|
|
|
|
|
[Route("Dlna")]
|
|
|
|
|
[DlnaEnabled]
|
|
|
|
|
[Authorize(Policy = Policies.AnonymousLanAccessPolicy)]
|
|
|
|
|
public class DlnaServerController : BaseJellyfinApiController
|
|
|
|
|
{
|
|
|
|
@ -54,8 +55,6 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[Produces(MediaTypeNames.Text.Xml)]
|
|
|
|
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
|
|
|
|
public ActionResult GetDescriptionXml([FromRoute, Required] string serverId)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
var url = GetAbsoluteUri();
|
|
|
|
|
var serverAddress = url.Substring(0, url.IndexOf("/dlna/", StringComparison.OrdinalIgnoreCase));
|
|
|
|
@ -63,9 +62,6 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
return Ok(xml);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets Dlna content directory xml.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -82,15 +78,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
|
|
|
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
|
|
|
|
public ActionResult GetContentDirectory([FromRoute, Required] string serverId)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return Ok(_contentDirectory.GetServiceXml());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets Dlna media receiver registrar xml.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -107,15 +98,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
|
|
|
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
|
|
|
|
public ActionResult GetMediaReceiverRegistrar([FromRoute, Required] string serverId)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return Ok(_mediaReceiverRegistrar.GetServiceXml());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets Dlna media receiver registrar xml.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -132,15 +118,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
|
|
|
|
[SuppressMessage("Microsoft.Performance", "CA1801:ReviewUnusedParameters", MessageId = "serverId", Justification = "Required for DLNA")]
|
|
|
|
|
public ActionResult GetConnectionManager([FromRoute, Required] string serverId)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return Ok(_connectionManager.GetServiceXml());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Process a content directory control request.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -154,15 +135,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[Produces(MediaTypeNames.Text.Xml)]
|
|
|
|
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
|
|
|
|
public async Task<ActionResult<ControlResponse>> ProcessContentDirectoryControlRequest([FromRoute, Required] string serverId)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return await ProcessControlRequestInternalAsync(serverId, Request.Body, _contentDirectory).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Process a connection manager control request.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -176,15 +152,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[Produces(MediaTypeNames.Text.Xml)]
|
|
|
|
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
|
|
|
|
public async Task<ActionResult<ControlResponse>> ProcessConnectionManagerControlRequest([FromRoute, Required] string serverId)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return await ProcessControlRequestInternalAsync(serverId, Request.Body, _connectionManager).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Process a media receiver registrar control request.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -198,15 +169,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[Produces(MediaTypeNames.Text.Xml)]
|
|
|
|
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
|
|
|
|
public async Task<ActionResult<ControlResponse>> ProcessMediaReceiverRegistrarControlRequest([FromRoute, Required] string serverId)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return await ProcessControlRequestInternalAsync(serverId, Request.Body, _mediaReceiverRegistrar).ConfigureAwait(false);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Processes an event subscription request.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -223,15 +189,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[Produces(MediaTypeNames.Text.Xml)]
|
|
|
|
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
|
|
|
|
public ActionResult<EventSubscriptionResponse> ProcessMediaReceiverRegistrarEventRequest(string serverId)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return ProcessEventRequest(_mediaReceiverRegistrar);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Processes an event subscription request.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -248,15 +209,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[Produces(MediaTypeNames.Text.Xml)]
|
|
|
|
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
|
|
|
|
public ActionResult<EventSubscriptionResponse> ProcessContentDirectoryEventRequest(string serverId)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return ProcessEventRequest(_contentDirectory);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Processes an event subscription request.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -273,15 +229,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[Produces(MediaTypeNames.Text.Xml)]
|
|
|
|
|
[ProducesFile(MediaTypeNames.Text.Xml)]
|
|
|
|
|
public ActionResult<EventSubscriptionResponse> ProcessConnectionManagerEventRequest(string serverId)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return ProcessEventRequest(_connectionManager);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a server icon.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -298,15 +249,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
|
|
|
|
[ProducesImageFile]
|
|
|
|
|
public ActionResult GetIconId([FromRoute, Required] string serverId, [FromRoute, Required] string fileName)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return GetIconInternal(fileName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a server icon.
|
|
|
|
|
/// </summary>
|
|
|
|
@ -321,15 +267,10 @@ namespace Jellyfin.Api.Controllers
|
|
|
|
|
[ProducesResponseType(StatusCodes.Status503ServiceUnavailable)]
|
|
|
|
|
[ProducesImageFile]
|
|
|
|
|
public ActionResult GetIcon([FromRoute, Required] string fileName)
|
|
|
|
|
{
|
|
|
|
|
if (DlnaEntryPoint.Enabled)
|
|
|
|
|
{
|
|
|
|
|
return GetIconInternal(fileName);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return StatusCode(StatusCodes.Status503ServiceUnavailable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private ActionResult GetIconInternal(string fileName)
|
|
|
|
|
{
|
|
|
|
|
var icon = _dlnaManager.GetIcon(fileName);
|
|
|
|
|