2019-01-13 12:16:19 -07:00
|
|
|
using Emby.Dlna.Service;
|
|
|
|
using MediaBrowser.Common.Net;
|
2016-10-29 15:22:20 -07:00
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
using MediaBrowser.Controller.Dlna;
|
2018-12-13 06:18:25 -07:00
|
|
|
using Microsoft.Extensions.Logging;
|
2016-10-29 15:22:20 -07:00
|
|
|
|
2016-10-29 15:34:54 -07:00
|
|
|
namespace Emby.Dlna.ConnectionManager
|
2016-10-29 15:22:20 -07:00
|
|
|
{
|
|
|
|
public class ConnectionManager : BaseService, IConnectionManager
|
|
|
|
{
|
|
|
|
private readonly IDlnaManager _dlna;
|
|
|
|
private readonly ILogger _logger;
|
|
|
|
private readonly IServerConfigurationManager _config;
|
|
|
|
|
2019-02-01 09:43:31 -07:00
|
|
|
public ConnectionManager(IDlnaManager dlna, IServerConfigurationManager config, ILogger logger, IHttpClient httpClient)
|
2016-10-29 15:22:20 -07:00
|
|
|
: base(logger, httpClient)
|
|
|
|
{
|
|
|
|
_dlna = dlna;
|
|
|
|
_config = config;
|
|
|
|
_logger = logger;
|
|
|
|
}
|
|
|
|
|
2019-02-27 06:23:39 -07:00
|
|
|
public string GetServiceXml()
|
2016-10-29 15:22:20 -07:00
|
|
|
{
|
|
|
|
return new ConnectionManagerXmlBuilder().GetXml();
|
|
|
|
}
|
|
|
|
|
|
|
|
public ControlResponse ProcessControlRequest(ControlRequest request)
|
|
|
|
{
|
|
|
|
var profile = _dlna.GetProfile(request.Headers) ??
|
|
|
|
_dlna.GetDefaultProfile();
|
|
|
|
|
2019-02-01 09:43:31 -07:00
|
|
|
return new ControlHandler(_config, _logger, profile).ProcessControlRequest(request);
|
2016-10-29 15:22:20 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|