aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Dlna
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Dlna')
-rw-r--r--MediaBrowser.Dlna/ConnectionManager/ConnectionManager.cs11
-rw-r--r--MediaBrowser.Dlna/ContentDirectory/ContentDirectory.cs18
-rw-r--r--MediaBrowser.Dlna/Eventing/EventManager.cs4
-rw-r--r--MediaBrowser.Dlna/MediaBrowser.Dlna.csproj1
-rw-r--r--MediaBrowser.Dlna/Service/BaseService.cs37
5 files changed, 55 insertions, 16 deletions
diff --git a/MediaBrowser.Dlna/ConnectionManager/ConnectionManager.cs b/MediaBrowser.Dlna/ConnectionManager/ConnectionManager.cs
index 3270fca72c..62cd3904dc 100644
--- a/MediaBrowser.Dlna/ConnectionManager/ConnectionManager.cs
+++ b/MediaBrowser.Dlna/ConnectionManager/ConnectionManager.cs
@@ -1,21 +1,24 @@
-using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
+using MediaBrowser.Dlna.Service;
using MediaBrowser.Model.Logging;
using System.Collections.Generic;
namespace MediaBrowser.Dlna.ConnectionManager
{
- public class ConnectionManager : IConnectionManager
+ public class ConnectionManager : BaseService, IConnectionManager
{
private readonly IDlnaManager _dlna;
private readonly ILogger _logger;
private readonly IServerConfigurationManager _config;
- public ConnectionManager(IDlnaManager dlna, ILogManager logManager, IServerConfigurationManager config)
+ public ConnectionManager(IDlnaManager dlna, IServerConfigurationManager config, ILogger logger, IHttpClient httpClient)
+ : base(logger, httpClient)
{
_dlna = dlna;
_config = config;
- _logger = logManager.GetLogger("UpnpConnectionManager");
+ _logger = logger;
}
public string GetServiceXml(IDictionary<string, string> headers)
diff --git a/MediaBrowser.Dlna/ContentDirectory/ContentDirectory.cs b/MediaBrowser.Dlna/ContentDirectory/ContentDirectory.cs
index d1b29502d7..5f0a863e71 100644
--- a/MediaBrowser.Dlna/ContentDirectory/ContentDirectory.cs
+++ b/MediaBrowser.Dlna/ContentDirectory/ContentDirectory.cs
@@ -1,9 +1,11 @@
-using MediaBrowser.Controller.Configuration;
+using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Dto;
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
+using MediaBrowser.Dlna.Service;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Logging;
using System;
@@ -12,9 +14,8 @@ using System.Linq;
namespace MediaBrowser.Dlna.ContentDirectory
{
- public class ContentDirectory : IContentDirectory, IDisposable
+ public class ContentDirectory : BaseService, IContentDirectory, IDisposable
{
- private readonly ILogger _logger;
private readonly ILibraryManager _libraryManager;
private readonly IDtoService _dtoService;
private readonly IImageProcessor _imageProcessor;
@@ -23,17 +24,16 @@ namespace MediaBrowser.Dlna.ContentDirectory
private readonly IServerConfigurationManager _config;
private readonly IUserManager _userManager;
- private readonly IEventManager _eventManager;
-
public ContentDirectory(IDlnaManager dlna,
IUserDataManager userDataManager,
IImageProcessor imageProcessor,
IDtoService dtoService,
ILibraryManager libraryManager,
- ILogManager logManager,
IServerConfigurationManager config,
IUserManager userManager,
- IEventManager eventManager)
+ ILogger logger,
+ IHttpClient httpClient)
+ : base(logger, httpClient)
{
_dlna = dlna;
_userDataManager = userDataManager;
@@ -42,8 +42,6 @@ namespace MediaBrowser.Dlna.ContentDirectory
_libraryManager = libraryManager;
_config = config;
_userManager = userManager;
- _eventManager = eventManager;
- _logger = logManager.GetLogger("UpnpContentDirectory");
}
private int SystemUpdateId
@@ -71,7 +69,7 @@ namespace MediaBrowser.Dlna.ContentDirectory
var user = GetUser(profile);
return new ControlHandler(
- _logger,
+ Logger,
_libraryManager,
profile,
serverAddress,
diff --git a/MediaBrowser.Dlna/Eventing/EventManager.cs b/MediaBrowser.Dlna/Eventing/EventManager.cs
index 3961c366a8..9a15cfb9b8 100644
--- a/MediaBrowser.Dlna/Eventing/EventManager.cs
+++ b/MediaBrowser.Dlna/Eventing/EventManager.cs
@@ -21,10 +21,10 @@ namespace MediaBrowser.Dlna.Eventing
private readonly ILogger _logger;
private readonly IHttpClient _httpClient;
- public EventManager(ILogManager logManager, IHttpClient httpClient)
+ public EventManager(ILogger logger, IHttpClient httpClient)
{
_httpClient = httpClient;
- _logger = logManager.GetLogger("DlnaEventManager");
+ _logger = logger;
}
public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, int? timeoutSeconds)
diff --git a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj
index caef50d36e..f5e9d44d88 100644
--- a/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj
+++ b/MediaBrowser.Dlna/MediaBrowser.Dlna.csproj
@@ -88,6 +88,7 @@
<Compile Include="ContentDirectory\ServiceActionListBuilder.cs" />
<Compile Include="ContentDirectory\ContentDirectoryXmlBuilder.cs" />
<Compile Include="Service\BaseControlHandler.cs" />
+ <Compile Include="Service\BaseService.cs" />
<Compile Include="Service\ControlErrorHandler.cs" />
<Compile Include="Service\ServiceXmlBuilder.cs" />
<Compile Include="Ssdp\Datagram.cs" />
diff --git a/MediaBrowser.Dlna/Service/BaseService.cs b/MediaBrowser.Dlna/Service/BaseService.cs
new file mode 100644
index 0000000000..aeea7b8f34
--- /dev/null
+++ b/MediaBrowser.Dlna/Service/BaseService.cs
@@ -0,0 +1,37 @@
+using MediaBrowser.Common.Net;
+using MediaBrowser.Controller.Dlna;
+using MediaBrowser.Dlna.Eventing;
+using MediaBrowser.Model.Logging;
+
+namespace MediaBrowser.Dlna.Service
+{
+ public class BaseService : IEventManager
+ {
+ protected IEventManager EventManager;
+ protected IHttpClient HttpClient;
+ protected ILogger Logger;
+
+ protected BaseService(ILogger logger, IHttpClient httpClient)
+ {
+ Logger = logger;
+ HttpClient = httpClient;
+
+ EventManager = new EventManager(Logger, HttpClient);
+ }
+
+ public EventSubscriptionResponse CancelEventSubscription(string subscriptionId)
+ {
+ return EventManager.CancelEventSubscription(subscriptionId);
+ }
+
+ public EventSubscriptionResponse RenewEventSubscription(string subscriptionId, int? timeoutSeconds)
+ {
+ return EventManager.RenewEventSubscription(subscriptionId, timeoutSeconds);
+ }
+
+ public EventSubscriptionResponse CreateEventSubscription(string notificationType, int? timeoutSeconds, string callbackUrl)
+ {
+ return EventManager.CreateEventSubscription(notificationType, timeoutSeconds, callbackUrl);
+ }
+ }
+}