2020-01-22 20:00:07 +00:00
|
|
|
#pragma warning disable CS1591
|
|
|
|
#pragma warning disable SA1600
|
|
|
|
|
2020-01-21 16:59:41 +00:00
|
|
|
using System.Threading.Tasks;
|
2019-01-13 19:16:19 +00:00
|
|
|
using Emby.Dlna.Service;
|
|
|
|
using MediaBrowser.Common.Net;
|
2016-10-29 22:22:20 +00:00
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
using MediaBrowser.Controller.Dlna;
|
2018-12-13 13:18:25 +00:00
|
|
|
using Microsoft.Extensions.Logging;
|
2016-10-29 22:22:20 +00:00
|
|
|
|
2016-10-29 22:34:54 +00:00
|
|
|
namespace Emby.Dlna.ConnectionManager
|
2016-10-29 22:22:20 +00:00
|
|
|
{
|
|
|
|
public class ConnectionManager : BaseService, IConnectionManager
|
|
|
|
{
|
|
|
|
private readonly IDlnaManager _dlna;
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
private readonly IServerConfigurationManager _config;
|
|
|
|
|
2019-02-01 16:43:31 +00:00
|
|
|
public ConnectionManager(IDlnaManager dlna, IServerConfigurationManager config, ILogger logger, IHttpClient httpClient)
|
2016-10-29 22:22:20 +00:00
|
|
|
: base(logger, httpClient)
|
|
|
|
{
|
|
|
|
_dlna = dlna;
|
|
|
|
_config = config;
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
|
2020-01-21 16:59:41 +00:00
|
|
|
/// <inheritdoc />
|
2019-02-27 13:23:39 +00:00
|
|
|
public string GetServiceXml()
|
2016-10-29 22:22:20 +00:00
|
|
|
{
|
|
|
|
return new ConnectionManagerXmlBuilder().GetXml();
|
|
|
|
}
|
|
|
|
|
2020-01-21 16:59:41 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
public Task<ControlResponse> ProcessControlRequestAsync(ControlRequest request)
|
2016-10-29 22:22:20 +00:00
|
|
|
{
|
|
|
|
var profile = _dlna.GetProfile(request.Headers) ??
|
|
|
|
_dlna.GetDefaultProfile();
|
|
|
|
|
2020-01-21 16:59:41 +00:00
|
|
|
return new ControlHandler(_config, _logger, profile).ProcessControlRequestAsync(request);
|
2016-10-29 22:22:20 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|