diff options
| author | WWWesten <4700006+WWWesten@users.noreply.github.com> | 2021-11-01 23:43:29 +0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2021-11-01 23:43:29 +0500 |
| commit | 0a14279e2a21bcb9654a06a2d49e1e4f0cc5329c (patch) | |
| tree | e1b1bd603b011ca98e5793e356326bf4a35a7050 /Emby.Dlna/ConnectionManager/ConnectionManagerService.cs | |
| parent | f2817fef743eeb75a00782ceea363b2d3e7dc9f2 (diff) | |
| parent | 76eeb8f655424d295e73ced8349c6fefee6ddb12 (diff) | |
Merge branch 'jellyfin:master' into master
Diffstat (limited to 'Emby.Dlna/ConnectionManager/ConnectionManagerService.cs')
| -rw-r--r-- | Emby.Dlna/ConnectionManager/ConnectionManagerService.cs | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/Emby.Dlna/ConnectionManager/ConnectionManagerService.cs b/Emby.Dlna/ConnectionManager/ConnectionManagerService.cs new file mode 100644 index 000000000..916044a0c --- /dev/null +++ b/Emby.Dlna/ConnectionManager/ConnectionManagerService.cs @@ -0,0 +1,53 @@ +#pragma warning disable CS1591 + +using System.Net.Http; +using System.Threading.Tasks; +using Emby.Dlna.Service; +using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Dlna; +using Microsoft.Extensions.Logging; + +namespace Emby.Dlna.ConnectionManager +{ + /// <summary> + /// Defines the <see cref="ConnectionManagerService" />. + /// </summary> + public class ConnectionManagerService : BaseService, IConnectionManager + { + 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> + public ConnectionManagerService( + IDlnaManager dlna, + IServerConfigurationManager config, + ILogger<ConnectionManagerService> logger, + IHttpClientFactory httpClientFactory) + : base(logger, httpClientFactory) + { + _dlna = dlna; + _config = config; + } + + /// <inheritdoc /> + public string GetServiceXml() + { + return ConnectionManagerXmlBuilder.GetXml(); + } + + /// <inheritdoc /> + public Task<ControlResponse> ProcessControlRequestAsync(ControlRequest request) + { + var profile = _dlna.GetProfile(request.Headers) ?? + _dlna.GetDefaultProfile(); + + return new ControlHandler(_config, Logger, profile).ProcessControlRequestAsync(request); + } + } +} |
