2016-10-29 22:22:20 +00:00
|
|
|
|
using MediaBrowser.Common.Net;
|
|
|
|
|
using MediaBrowser.Controller.Configuration;
|
|
|
|
|
using MediaBrowser.Controller.Dlna;
|
2016-10-29 22:34:54 +00:00
|
|
|
|
using Emby.Dlna.Service;
|
2016-10-29 22:22:20 +00:00
|
|
|
|
using System.Collections.Generic;
|
2016-11-04 08:31:05 +00:00
|
|
|
|
using MediaBrowser.Model.Xml;
|
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;
|
2016-11-04 08:31:05 +00:00
|
|
|
|
protected readonly IXmlReaderSettingsFactory XmlReaderSettingsFactory;
|
2016-10-29 22:22:20 +00:00
|
|
|
|
|
2016-11-04 08:31:05 +00:00
|
|
|
|
public ConnectionManager(IDlnaManager dlna, IServerConfigurationManager config, ILogger logger, IHttpClient httpClient, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
|
2016-10-29 22:22:20 +00:00
|
|
|
|
: base(logger, httpClient)
|
|
|
|
|
{
|
|
|
|
|
_dlna = dlna;
|
|
|
|
|
_config = config;
|
|
|
|
|
_logger = logger;
|
2016-11-04 08:31:05 +00:00
|
|
|
|
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
|
2016-10-29 22:22:20 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string GetServiceXml(IDictionary<string, string> headers)
|
|
|
|
|
{
|
|
|
|
|
return new ConnectionManagerXmlBuilder().GetXml();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public ControlResponse ProcessControlRequest(ControlRequest request)
|
|
|
|
|
{
|
|
|
|
|
var profile = _dlna.GetProfile(request.Headers) ??
|
|
|
|
|
_dlna.GetDefaultProfile();
|
|
|
|
|
|
2016-11-04 08:31:05 +00:00
|
|
|
|
return new ControlHandler(_config, _logger, XmlReaderSettingsFactory, profile).ProcessControlRequest(request);
|
2016-10-29 22:22:20 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|