jellyfin/Emby.Dlna/ConnectionManager/ConnectionManagerService.cs

54 lines
2.1 KiB
C#
Raw Normal View History

#pragma warning disable CS1591
using System.Net.Http;
2020-01-21 17:59:41 +01:00
using System.Threading.Tasks;
2019-01-13 20:16:19 +01:00
using Emby.Dlna.Service;
2016-10-30 00:22:20 +02:00
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
using Microsoft.Extensions.Logging;
2016-10-30 00:22:20 +02:00
2016-10-30 00:34:54 +02:00
namespace Emby.Dlna.ConnectionManager
2016-10-30 00:22:20 +02:00
{
/// <summary>
/// Defines the <see cref="ConnectionManagerService" />.
/// </summary>
2020-08-20 21:04:57 +02:00
public class ConnectionManagerService : BaseService, IConnectionManager
2016-10-30 00:22:20 +02:00
{
private readonly IDlnaManager _dlna;
private readonly IServerConfigurationManager _config;
/// <summary>
/// Initializes a new instance of the <see cref="ConnectionManagerService"/> class.
/// </summary>
/// <param name="dlna">The <see cref="IDlnaManager"/> for use with the <see cref="ConnectionManagerService"/> instance.</param>
/// <param name="config">The <see cref="IServerConfigurationManager"/> for use with the <see cref="ConnectionManagerService"/> instance.</param>
/// <param name="logger">The <see cref="ILogger{ConnectionManagerService}"/> for use with the <see cref="ConnectionManagerService"/> instance..</param>
/// <param name="httpClientFactory">The <see cref="IHttpClientFactory"/> for use with the <see cref="ConnectionManagerService"/> instance..</param>
2020-08-20 21:04:57 +02:00
public ConnectionManagerService(
IDlnaManager dlna,
IServerConfigurationManager config,
2020-08-20 21:04:57 +02:00
ILogger<ConnectionManagerService> logger,
IHttpClientFactory httpClientFactory)
: base(logger, httpClientFactory)
2016-10-30 00:22:20 +02:00
{
_dlna = dlna;
_config = config;
}
2020-01-21 17:59:41 +01:00
/// <inheritdoc />
public string GetServiceXml()
2016-10-30 00:22:20 +02:00
{
return ConnectionManagerXmlBuilder.GetXml();
2016-10-30 00:22:20 +02:00
}
2020-01-21 17:59:41 +01:00
/// <inheritdoc />
public Task<ControlResponse> ProcessControlRequestAsync(ControlRequest request)
2016-10-30 00:22:20 +02:00
{
var profile = _dlna.GetProfile(request.Headers) ??
_dlna.GetDefaultProfile();
2020-08-20 21:04:57 +02:00
return new ControlHandler(_config, Logger, profile).ProcessControlRequestAsync(request);
2016-10-30 00:22:20 +02:00
}
}
}