aboutsummaryrefslogtreecommitdiff
path: root/Emby.Dlna
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Dlna')
-rw-r--r--Emby.Dlna/ConnectionManager/ConnectionManager.cs2
-rw-r--r--Emby.Dlna/ConnectionManager/ControlHandler.cs2
-rw-r--r--Emby.Dlna/ContentDirectory/ContentDirectory.cs2
-rw-r--r--Emby.Dlna/ContentDirectory/ControlHandler.cs6
-rw-r--r--Emby.Dlna/Didl/DidlBuilder.cs28
-rw-r--r--Emby.Dlna/DlnaManager.cs29
-rw-r--r--Emby.Dlna/Eventing/EventManager.cs8
-rw-r--r--Emby.Dlna/Main/DlnaEntryPoint.cs30
-rw-r--r--Emby.Dlna/MediaReceiverRegistrar/ControlHandler.cs2
-rw-r--r--Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrar.cs2
-rw-r--r--Emby.Dlna/PlayTo/Device.cs18
-rw-r--r--Emby.Dlna/PlayTo/PlayToController.cs32
-rw-r--r--Emby.Dlna/PlayTo/PlayToManager.cs12
-rw-r--r--Emby.Dlna/Service/BaseControlHandler.cs16
-rw-r--r--Emby.Dlna/Service/BaseService.cs2
-rw-r--r--Emby.Dlna/Ssdp/DeviceDiscovery.cs2
16 files changed, 87 insertions, 106 deletions
diff --git a/Emby.Dlna/ConnectionManager/ConnectionManager.cs b/Emby.Dlna/ConnectionManager/ConnectionManager.cs
index 3f33f3ebf..ab747d189 100644
--- a/Emby.Dlna/ConnectionManager/ConnectionManager.cs
+++ b/Emby.Dlna/ConnectionManager/ConnectionManager.cs
@@ -2,9 +2,9 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
using Emby.Dlna.Service;
-using MediaBrowser.Model.Logging;
using System.Collections.Generic;
using MediaBrowser.Model.Xml;
+using Microsoft.Extensions.Logging;
namespace Emby.Dlna.ConnectionManager
{
diff --git a/Emby.Dlna/ConnectionManager/ControlHandler.cs b/Emby.Dlna/ConnectionManager/ControlHandler.cs
index ae983c5e7..7e3e5f650 100644
--- a/Emby.Dlna/ConnectionManager/ControlHandler.cs
+++ b/Emby.Dlna/ConnectionManager/ControlHandler.cs
@@ -3,7 +3,7 @@ using MediaBrowser.Controller.Configuration;
using Emby.Dlna.Server;
using Emby.Dlna.Service;
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Xml;
diff --git a/Emby.Dlna/ContentDirectory/ContentDirectory.cs b/Emby.Dlna/ContentDirectory/ContentDirectory.cs
index 0aabe099c..7c809a952 100644
--- a/Emby.Dlna/ContentDirectory/ContentDirectory.cs
+++ b/Emby.Dlna/ContentDirectory/ContentDirectory.cs
@@ -6,7 +6,7 @@ using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using Emby.Dlna.Service;
using MediaBrowser.Model.Dlna;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using MediaBrowser.Controller.MediaEncoding;
diff --git a/Emby.Dlna/ContentDirectory/ControlHandler.cs b/Emby.Dlna/ContentDirectory/ControlHandler.cs
index bf9c48ac7..57d4078a5 100644
--- a/Emby.Dlna/ContentDirectory/ControlHandler.cs
+++ b/Emby.Dlna/ContentDirectory/ControlHandler.cs
@@ -12,7 +12,7 @@ using Emby.Dlna.Service;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Querying;
using System;
using System.Collections.Generic;
@@ -68,7 +68,7 @@ namespace Emby.Dlna.ContentDirectory
_profile = profile;
_config = config;
- _didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization, mediaSourceManager, Logger, libraryManager, mediaEncoder);
+ _didlBuilder = new DidlBuilder(profile, user, imageProcessor, serverAddress, accessToken, userDataManager, localization, mediaSourceManager, _logger, libraryManager, mediaEncoder);
}
protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, IDictionary<string, string> methodParams)
@@ -1334,7 +1334,7 @@ namespace Emby.Dlna.ContentDirectory
};
}
- Logger.Error("Error parsing item Id: {0}. Returning user root folder.", id);
+ _logger.LogError("Error parsing item Id: {id}. Returning user root folder.", id);
return new ServerItem(_libraryManager.GetUserRootFolder());
}
diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs
index 8d59ea3ff..7af48ae17 100644
--- a/Emby.Dlna/Didl/DidlBuilder.cs
+++ b/Emby.Dlna/Didl/DidlBuilder.cs
@@ -11,7 +11,7 @@ using Emby.Dlna.ContentDirectory;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Drawing;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using System;
using System.Globalization;
@@ -173,16 +173,6 @@ namespace Emby.Dlna.Didl
writer.WriteFullEndElement();
}
- private ILogger GetStreamBuilderLogger(DlnaOptions options)
- {
- if (options.EnableDebugLog)
- {
- return _logger;
- }
-
- return new NullLogger();
- }
-
private string GetMimeType(string input)
{
var mime = MimeTypes.GetMimeType(input);
@@ -202,7 +192,7 @@ namespace Emby.Dlna.Didl
{
var sources = _mediaSourceManager.GetStaticMediaSources(video, true, _user);
- streamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger(options)).BuildVideoItem(new VideoOptions
+ streamInfo = new StreamBuilder(_mediaEncoder, _logger).BuildVideoItem(new VideoOptions
{
ItemId = video.Id,
MediaSources = sources.ToArray(),
@@ -509,7 +499,7 @@ namespace Emby.Dlna.Didl
{
var sources = _mediaSourceManager.GetStaticMediaSources(audio, true, _user);
- streamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger(options)).BuildAudioItem(new AudioOptions
+ streamInfo = new StreamBuilder(_mediaEncoder, _logger).BuildAudioItem(new AudioOptions
{
ItemId = audio.Id,
MediaSources = sources.ToArray(),
@@ -923,9 +913,9 @@ namespace Emby.Dlna.Didl
writer.WriteFullEndElement();
}
- catch (XmlException)
+ catch (XmlException ex)
{
- //_logger.Error("Error adding xml value: " + value);
+ _logger.LogError(ex, "Error adding xml value: {value}", name);
}
}
@@ -935,9 +925,9 @@ namespace Emby.Dlna.Didl
{
writer.WriteElementString(prefix, name, namespaceUri, value);
}
- catch (XmlException)
+ catch (XmlException ex)
{
- //_logger.Error("Error adding xml value: " + value);
+ _logger.LogError(ex, "Error adding xml value: {value}", value);
}
}
@@ -1080,9 +1070,9 @@ namespace Emby.Dlna.Didl
{
tag = _imageProcessor.GetImageCacheTag(item, type);
}
- catch
+ catch (Exception ex)
{
-
+ _logger.LogError(ex, "Error getting image cache tag");
}
int? width = imageInfo.Width;
diff --git a/Emby.Dlna/DlnaManager.cs b/Emby.Dlna/DlnaManager.cs
index 62d1eb57c..48a33757b 100644
--- a/Emby.Dlna/DlnaManager.cs
+++ b/Emby.Dlna/DlnaManager.cs
@@ -8,7 +8,7 @@ using Emby.Dlna.Profiles;
using Emby.Dlna.Server;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Drawing;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Serialization;
using System;
using System.Collections.Generic;
@@ -58,7 +58,7 @@ namespace Emby.Dlna
}
catch (Exception ex)
{
- _logger.ErrorException("Error extracting DLNA profiles.", ex);
+ _logger.LogError(ex, "Error extracting DLNA profiles.");
}
}
@@ -103,7 +103,7 @@ namespace Emby.Dlna
if (profile != null)
{
- _logger.Debug("Found matching device profile: {0}", profile.Name);
+ _logger.LogDebug("Found matching device profile: {0}", profile.Name);
}
else
{
@@ -117,6 +117,7 @@ namespace Emby.Dlna
{
var builder = new StringBuilder();
+ builder.AppendLine("No matching device profile found. The default will need to be used.");
builder.AppendLine(string.Format("DeviceDescription:{0}", profile.DeviceDescription ?? string.Empty));
builder.AppendLine(string.Format("FriendlyName:{0}", profile.FriendlyName ?? string.Empty));
builder.AppendLine(string.Format("Manufacturer:{0}", profile.Manufacturer ?? string.Empty));
@@ -127,7 +128,7 @@ namespace Emby.Dlna
builder.AppendLine(string.Format("ModelUrl:{0}", profile.ModelUrl ?? string.Empty));
builder.AppendLine(string.Format("SerialNumber:{0}", profile.SerialNumber ?? string.Empty));
- _logger.LogMultiline("No matching device profile found. The default will need to be used.", LogSeverity.Info, builder);
+ _logger.LogInformation(builder.ToString());
}
private bool IsMatch(DeviceIdentification deviceInfo, DeviceIdentification profileInfo)
@@ -197,7 +198,7 @@ namespace Emby.Dlna
}
catch (ArgumentException ex)
{
- _logger.ErrorException("Error evaluating regex pattern {0}", ex, pattern);
+ _logger.LogError(ex, "Error evaluating regex pattern {Pattern}", pattern);
return false;
}
}
@@ -216,12 +217,12 @@ namespace Emby.Dlna
if (profile != null)
{
- _logger.Debug("Found matching device profile: {0}", profile.Name);
+ _logger.LogDebug("Found matching device profile: {0}", profile.Name);
}
else
{
var headerString = string.Join(", ", headers.Select(i => string.Format("{0}={1}", i.Key, i.Value)).ToArray());
- _logger.Debug("No matching device profile found. {0}", headerString);
+ _logger.LogDebug("No matching device profile found. {0}", headerString);
}
return profile;
@@ -250,7 +251,7 @@ namespace Emby.Dlna
return string.Equals(value, header.Value, StringComparison.OrdinalIgnoreCase);
case HeaderMatchType.Substring:
var isMatch = value.IndexOf(header.Value, StringComparison.OrdinalIgnoreCase) != -1;
- //_logger.Debug("IsMatch-Substring value: {0} testValue: {1} isMatch: {2}", value, header.Value, isMatch);
+ //_logger.LogDebug("IsMatch-Substring value: {0} testValue: {1} isMatch: {2}", value, header.Value, isMatch);
return isMatch;
case HeaderMatchType.Regex:
return Regex.IsMatch(value, header.Value, RegexOptions.IgnoreCase);
@@ -323,7 +324,7 @@ namespace Emby.Dlna
}
catch (Exception ex)
{
- _logger.ErrorException("Error parsing profile file: {0}", ex, path);
+ _logger.LogError(ex, "Error parsing profile file: {Path}", path);
return null;
}
@@ -530,8 +531,8 @@ namespace Emby.Dlna
};
}
}
-
- class DlnaProfileEntryPoint /*: IServerEntryPoint*/
+ /*
+ class DlnaProfileEntryPoint : IServerEntryPoint
{
private readonly IApplicationPaths _appPaths;
private readonly IFileSystem _fileSystem;
@@ -551,7 +552,7 @@ namespace Emby.Dlna
private void DumpProfiles()
{
- var list = new List<DeviceProfile>
+ DeviceProfile[] list = new []
{
new SamsungSmartTvProfile(),
new XboxOneProfile(),
@@ -596,5 +597,5 @@ namespace Emby.Dlna
public void Dispose()
{
}
- }
-} \ No newline at end of file
+ }*/
+}
diff --git a/Emby.Dlna/Eventing/EventManager.cs b/Emby.Dlna/Eventing/EventManager.cs
index 0638cff89..ea9ba3f22 100644
--- a/Emby.Dlna/Eventing/EventManager.cs
+++ b/Emby.Dlna/Eventing/EventManager.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Common.Extensions;
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Dlna;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
@@ -34,7 +34,7 @@ namespace Emby.Dlna.Eventing
// Remove logging for now because some devices are sending this very frequently
// TODO re-enable with dlna debug logging setting
- //_logger.Debug("Renewing event subscription for {0} with timeout of {1} to {2}",
+ //_logger.LogDebug("Renewing event subscription for {0} with timeout of {1} to {2}",
// subscription.NotificationType,
// timeout,
// subscription.CallbackUrl);
@@ -60,7 +60,7 @@ namespace Emby.Dlna.Eventing
// Remove logging for now because some devices are sending this very frequently
// TODO re-enable with dlna debug logging setting
- //_logger.Debug("Creating event subscription for {0} with timeout of {1} to {2}",
+ //_logger.LogDebug("Creating event subscription for {0} with timeout of {1} to {2}",
// notificationType,
// timeout,
// callbackUrl);
@@ -96,7 +96,7 @@ namespace Emby.Dlna.Eventing
public EventSubscriptionResponse CancelEventSubscription(string subscriptionId)
{
- _logger.Debug("Cancelling event subscription {0}", subscriptionId);
+ _logger.LogDebug("Cancelling event subscription {0}", subscriptionId);
EventSubscription sub;
_subscriptions.TryRemove(subscriptionId, out sub);
diff --git a/Emby.Dlna/Main/DlnaEntryPoint.cs b/Emby.Dlna/Main/DlnaEntryPoint.cs
index cd535a98a..6ab0767a5 100644
--- a/Emby.Dlna/Main/DlnaEntryPoint.cs
+++ b/Emby.Dlna/Main/DlnaEntryPoint.cs
@@ -11,7 +11,7 @@ using MediaBrowser.Controller.Session;
using MediaBrowser.Controller.TV;
using Emby.Dlna.PlayTo;
using Emby.Dlna.Ssdp;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Linq;
using System.Threading.Tasks;
@@ -64,7 +64,7 @@ namespace Emby.Dlna.Main
public static DlnaEntryPoint Current;
public DlnaEntryPoint(IServerConfigurationManager config,
- ILogManager logManager,
+ ILoggerFactory loggerFactory,
IServerApplicationHost appHost,
ISessionManager sessionManager,
IHttpClient httpClient,
@@ -102,7 +102,7 @@ namespace Emby.Dlna.Main
_timerFactory = timerFactory;
_environmentInfo = environmentInfo;
_networkManager = networkManager;
- _logger = logManager.GetLogger("Dlna");
+ _logger = loggerFactory.CreateLogger("Dlna");
ContentDirectory = new ContentDirectory.ContentDirectory(dlnaManager,
userDataManager,
@@ -185,13 +185,13 @@ namespace Emby.Dlna.Main
}
catch (Exception ex)
{
- _logger.ErrorException("Error starting ssdp handlers", ex);
+ _logger.LogError(ex, "Error starting ssdp handlers");
}
}
private void LogMessage(string msg)
{
- _logger.Debug(msg);
+ _logger.LogDebug(msg);
}
private void StartDeviceDiscovery(ISsdpCommunicationsServer communicationsServer)
@@ -202,7 +202,7 @@ namespace Emby.Dlna.Main
}
catch (Exception ex)
{
- _logger.ErrorException("Error starting device discovery", ex);
+ _logger.LogError(ex, "Error starting device discovery");
}
}
@@ -210,12 +210,12 @@ namespace Emby.Dlna.Main
{
try
{
- _logger.Info("Disposing DeviceDiscovery");
+ _logger.LogInformation("Disposing DeviceDiscovery");
((DeviceDiscovery)_deviceDiscovery).Dispose();
}
catch (Exception ex)
{
- _logger.ErrorException("Error stopping device discovery", ex);
+ _logger.LogError(ex, "Error stopping device discovery");
}
}
@@ -243,7 +243,7 @@ namespace Emby.Dlna.Main
}
catch (Exception ex)
{
- _logger.ErrorException("Error registering endpoint", ex);
+ _logger.LogError(ex, "Error registering endpoint");
}
}
@@ -263,7 +263,7 @@ namespace Emby.Dlna.Main
var fullService = "urn:schemas-upnp-org:device:MediaServer:1";
- _logger.Info("Registering publisher for {0} on {1}", fullService, address.ToString());
+ _logger.LogInformation("Registering publisher for {0} on {1}", fullService, address.ToString());
var descriptorUri = "/dlna/" + udn + "/description.xml";
var uri = new Uri(_appHost.GetLocalApiUrl(address) + descriptorUri);
@@ -361,7 +361,7 @@ namespace Emby.Dlna.Main
}
catch (Exception ex)
{
- _logger.ErrorException("Error starting PlayTo manager", ex);
+ _logger.LogError(ex, "Error starting PlayTo manager");
}
}
}
@@ -374,12 +374,12 @@ namespace Emby.Dlna.Main
{
try
{
- _logger.Info("Disposing PlayToManager");
+ _logger.LogInformation("Disposing PlayToManager");
_manager.Dispose();
}
catch (Exception ex)
{
- _logger.ErrorException("Error disposing PlayTo manager", ex);
+ _logger.LogError(ex, "Error disposing PlayTo manager");
}
_manager = null;
}
@@ -394,7 +394,7 @@ namespace Emby.Dlna.Main
if (_communicationsServer != null)
{
- _logger.Info("Disposing SsdpCommunicationsServer");
+ _logger.LogInformation("Disposing SsdpCommunicationsServer");
_communicationsServer.Dispose();
_communicationsServer = null;
}
@@ -409,7 +409,7 @@ namespace Emby.Dlna.Main
{
if (_Publisher != null)
{
- _logger.Info("Disposing SsdpDevicePublisher");
+ _logger.LogInformation("Disposing SsdpDevicePublisher");
_Publisher.Dispose();
_Publisher = null;
}
diff --git a/Emby.Dlna/MediaReceiverRegistrar/ControlHandler.cs b/Emby.Dlna/MediaReceiverRegistrar/ControlHandler.cs
index daf46b106..d1a595de0 100644
--- a/Emby.Dlna/MediaReceiverRegistrar/ControlHandler.cs
+++ b/Emby.Dlna/MediaReceiverRegistrar/ControlHandler.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Controller.Configuration;
using Emby.Dlna.Server;
using Emby.Dlna.Service;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Xml;
diff --git a/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrar.cs b/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrar.cs
index 4ed74a684..f07af0464 100644
--- a/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrar.cs
+++ b/Emby.Dlna/MediaReceiverRegistrar/MediaReceiverRegistrar.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
using Emby.Dlna.Service;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using MediaBrowser.Model.Xml;
diff --git a/Emby.Dlna/PlayTo/Device.cs b/Emby.Dlna/PlayTo/Device.cs
index 47e3196e1..13bed6b2f 100644
--- a/Emby.Dlna/PlayTo/Device.cs
+++ b/Emby.Dlna/PlayTo/Device.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Controller.Configuration;
using Emby.Dlna.Common;
using Emby.Dlna.Ssdp;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Net;
using System;
using System.Collections.Generic;
@@ -108,7 +108,7 @@ namespace Emby.Dlna.PlayTo
public void Start()
{
- _logger.Debug("Dlna Device.Start");
+ _logger.LogDebug("Dlna Device.Start");
_timer = _timerFactory.Create(TimerCallback, null, 1000, Timeout.Infinite);
}
@@ -140,7 +140,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
- _logger.ErrorException("Error updating device volume info for {0}", ex, Properties.Name);
+ _logger.LogError(ex, "Error updating device volume info for {DeviceName}", Properties.Name);
}
}
@@ -259,7 +259,7 @@ namespace Emby.Dlna.PlayTo
return false;
}
- _logger.Debug("Setting mute");
+ _logger.LogDebug("Setting mute");
var value = mute ? 1 : 0;
await new SsdpHttpClient(_httpClient, _config).SendCommandAsync(Properties.BaseUrl, service, command.Name, rendererCommands.BuildPost(command, service.ServiceType, value))
@@ -323,7 +323,7 @@ namespace Emby.Dlna.PlayTo
url = url.Replace("&", "&amp;");
- _logger.Debug("{0} - SetAvTransport Uri: {1} DlnaHeaders: {2}", Properties.Name, url, header);
+ _logger.LogDebug("{0} - SetAvTransport Uri: {1} DlnaHeaders: {2}", Properties.Name, url, header);
var command = avCommands.ServiceActions.FirstOrDefault(c => c.Name == "SetAVTransportURI");
if (command == null)
@@ -507,7 +507,7 @@ namespace Emby.Dlna.PlayTo
if (_disposed)
return;
- //_logger.ErrorException("Error updating device info for {0}", ex, Properties.Name);
+ _logger.LogError(ex, "Error updating device info for {DeviceName}", Properties.Name);
_connectFailureCount++;
@@ -516,7 +516,7 @@ namespace Emby.Dlna.PlayTo
var action = OnDeviceUnavailable;
if (action != null)
{
- _logger.Debug("Disposing device due to loss of connection");
+ _logger.LogDebug("Disposing device due to loss of connection");
action();
return;
}
@@ -767,7 +767,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
- _logger.ErrorException("Unable to parse xml {0}", ex, trackString);
+ _logger.LogError(ex, "Unable to parse xml {0}", trackString);
return new Tuple<bool, uBaseObject>(true, null);
}
}
@@ -887,7 +887,7 @@ namespace Emby.Dlna.PlayTo
string url = NormalizeUrl(Properties.BaseUrl, avService.ScpdUrl);
var httpClient = new SsdpHttpClient(_httpClient, _config);
- _logger.Debug("Dlna Device.GetRenderingProtocolAsync");
+ _logger.LogDebug("Dlna Device.GetRenderingProtocolAsync");
var document = await httpClient.GetDataAsync(url, cancellationToken).ConfigureAwait(false);
rendererCommands = TransportCommands.Create(document);
diff --git a/Emby.Dlna/PlayTo/PlayToController.cs b/Emby.Dlna/PlayTo/PlayToController.cs
index 2d0d7c99c..c51f220ef 100644
--- a/Emby.Dlna/PlayTo/PlayToController.cs
+++ b/Emby.Dlna/PlayTo/PlayToController.cs
@@ -7,7 +7,7 @@ using Emby.Dlna.Didl;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Dto;
using MediaBrowser.Model.Entities;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Session;
using MediaBrowser.Model.System;
using System;
@@ -156,7 +156,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
- _logger.ErrorException("Error reporting progress", ex);
+ _logger.LogError(ex, "Error reporting progress");
}
}
@@ -204,7 +204,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
- _logger.ErrorException("Error reporting playback stopped", ex);
+ _logger.LogError(ex, "Error reporting playback stopped");
}
}
@@ -223,7 +223,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
- _logger.ErrorException("Error reporting progress", ex);
+ _logger.LogError(ex, "Error reporting progress");
}
}
@@ -247,7 +247,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
- _logger.ErrorException("Error reporting progress", ex);
+ _logger.LogError(ex, "Error reporting progress");
}
}
@@ -278,7 +278,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
- _logger.ErrorException("Error reporting progress", ex);
+ _logger.LogError(ex, "Error reporting progress");
}
}
@@ -319,7 +319,7 @@ namespace Emby.Dlna.PlayTo
public async Task SendPlayCommand(PlayRequest command, CancellationToken cancellationToken)
{
- _logger.Debug("{0} - Received PlayRequest: {1}", this._session.DeviceName, command.PlayCommand);
+ _logger.LogDebug("{0} - Received PlayRequest: {1}", this._session.DeviceName, command.PlayCommand);
var user = command.ControllingUserId.Equals(Guid.Empty) ? null : _userManager.GetUserById(command.ControllingUserId);
@@ -351,7 +351,7 @@ namespace Emby.Dlna.PlayTo
}
}
- _logger.Debug("{0} - Playlist created", _session.DeviceName);
+ _logger.LogDebug("{0} - Playlist created", _session.DeviceName);
if (command.PlayCommand == PlayCommand.PlayLast)
{
@@ -532,23 +532,13 @@ namespace Emby.Dlna.PlayTo
return null;
}
- private ILogger GetStreamBuilderLogger()
- {
- if (_config.GetDlnaConfiguration().EnableDebugLog)
- {
- return _logger;
- }
-
- return new NullLogger();
- }
-
private PlaylistItem GetPlaylistItem(BaseItem item, List<MediaSourceInfo> mediaSources, DeviceProfile profile, string deviceId, string mediaSourceId, int? audioStreamIndex, int? subtitleStreamIndex)
{
if (string.Equals(item.MediaType, MediaType.Video, StringComparison.OrdinalIgnoreCase))
{
return new PlaylistItem
{
- StreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger()).BuildVideoItem(new VideoOptions
+ StreamInfo = new StreamBuilder(_mediaEncoder, _logger).BuildVideoItem(new VideoOptions
{
ItemId = item.Id,
MediaSources = mediaSources.ToArray(),
@@ -568,7 +558,7 @@ namespace Emby.Dlna.PlayTo
{
return new PlaylistItem
{
- StreamInfo = new StreamBuilder(_mediaEncoder, GetStreamBuilderLogger()).BuildAudioItem(new AudioOptions
+ StreamInfo = new StreamBuilder(_mediaEncoder, _logger).BuildAudioItem(new AudioOptions
{
ItemId = item.Id,
MediaSources = mediaSources.ToArray(),
@@ -599,7 +589,7 @@ namespace Emby.Dlna.PlayTo
{
Playlist.Clear();
Playlist.AddRange(items);
- _logger.Debug("{0} - Playing {1} items", _session.DeviceName, Playlist.Count);
+ _logger.LogDebug("{0} - Playing {1} items", _session.DeviceName, Playlist.Count);
await SetPlaylistIndex(0).ConfigureAwait(false);
return true;
diff --git a/Emby.Dlna/PlayTo/PlayToManager.cs b/Emby.Dlna/PlayTo/PlayToManager.cs
index ed3cf311b..47d00aad5 100644
--- a/Emby.Dlna/PlayTo/PlayToManager.cs
+++ b/Emby.Dlna/PlayTo/PlayToManager.cs
@@ -5,7 +5,7 @@ using MediaBrowser.Controller.Dlna;
using MediaBrowser.Controller.Drawing;
using MediaBrowser.Controller.Library;
using MediaBrowser.Controller.Session;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using MediaBrowser.Model.Session;
using System;
using System.Collections.Generic;
@@ -93,7 +93,7 @@ namespace Emby.Dlna.PlayTo
if (usn.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) == -1 &&
nt.IndexOf("MediaRenderer:", StringComparison.OrdinalIgnoreCase) == -1)
{
- //_logger.Debug("Upnp device {0} does not contain a MediaRenderer device (0).", location);
+ //_logger.LogDebug("Upnp device {0} does not contain a MediaRenderer device (0).", location);
return;
}
@@ -121,7 +121,7 @@ namespace Emby.Dlna.PlayTo
}
catch (Exception ex)
{
- _logger.ErrorException("Error creating PlayTo device.", ex);
+ _logger.LogError(ex, "Error creating PlayTo device.");
}
finally
{
@@ -155,9 +155,9 @@ namespace Emby.Dlna.PlayTo
private async Task AddDevice(UpnpDeviceInfo info, string location, CancellationToken cancellationToken)
{
var uri = info.Location;
- _logger.Debug("Attempting to create PlayToController from location {0}", location);
+ _logger.LogDebug("Attempting to create PlayToController from location {0}", location);
- _logger.Debug("Logging session activity from location {0}", location);
+ _logger.LogDebug("Logging session activity from location {0}", location);
string uuid;
if (info.Headers.TryGetValue("USN", out uuid))
{
@@ -237,7 +237,7 @@ namespace Emby.Dlna.PlayTo
SupportsMediaControl = true
});
- _logger.Info("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
+ _logger.LogInformation("DLNA Session created for {0} - {1}", device.Properties.Name, device.Properties.ModelName);
}
}
diff --git a/Emby.Dlna/Service/BaseControlHandler.cs b/Emby.Dlna/Service/BaseControlHandler.cs
index 450941489..ae094cc2f 100644
--- a/Emby.Dlna/Service/BaseControlHandler.cs
+++ b/Emby.Dlna/Service/BaseControlHandler.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
using Emby.Dlna.Server;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.IO;
@@ -20,13 +20,13 @@ namespace Emby.Dlna.Service
private const string NS_SOAPENV = "http://schemas.xmlsoap.org/soap/envelope/";
protected readonly IServerConfigurationManager Config;
- protected readonly ILogger Logger;
+ protected readonly ILogger _logger;
protected readonly IXmlReaderSettingsFactory XmlReaderSettingsFactory;
protected BaseControlHandler(IServerConfigurationManager config, ILogger logger, IXmlReaderSettingsFactory xmlReaderSettingsFactory)
{
Config = config;
- Logger = logger;
+ _logger = logger;
XmlReaderSettingsFactory = xmlReaderSettingsFactory;
}
@@ -52,7 +52,7 @@ namespace Emby.Dlna.Service
}
catch (Exception ex)
{
- Logger.ErrorException("Error processing control request", ex);
+ _logger.LogError(ex, "Error processing control request");
return new ControlErrorHandler().GetResponse(ex);
}
@@ -76,7 +76,7 @@ namespace Emby.Dlna.Service
}
}
- Logger.Debug("Received control request {0}", requestInfo.LocalName);
+ _logger.LogDebug("Received control request {0}", requestInfo.LocalName);
var result = GetResult(requestInfo.LocalName, requestInfo.Headers);
@@ -118,7 +118,7 @@ namespace Emby.Dlna.Service
IsSuccessful = true
};
- //Logger.Debug(xml);
+ //logger.LogDebug(xml);
controlResponse.Headers.Add("EXT", string.Empty);
@@ -244,7 +244,7 @@ namespace Emby.Dlna.Service
var originalHeaders = request.Headers;
var headers = string.Join(", ", originalHeaders.Select(i => string.Format("{0}={1}", i.Key, i.Value)).ToArray());
- Logger.Debug("Control request. Headers: {0}", headers);
+ _logger.LogDebug("Control request. Headers: {0}", headers);
}
private void LogResponse(ControlResponse response)
@@ -258,7 +258,7 @@ namespace Emby.Dlna.Service
var headers = string.Join(", ", originalHeaders.Select(i => string.Format("{0}={1}", i.Key, i.Value)).ToArray());
//builder.Append(response.Xml);
- Logger.Debug("Control response. Headers: {0}", headers);
+ _logger.LogDebug("Control response. Headers: {0}", headers);
}
}
}
diff --git a/Emby.Dlna/Service/BaseService.cs b/Emby.Dlna/Service/BaseService.cs
index bc7f01d97..92b81a7ac 100644
--- a/Emby.Dlna/Service/BaseService.cs
+++ b/Emby.Dlna/Service/BaseService.cs
@@ -1,7 +1,7 @@
using MediaBrowser.Common.Net;
using MediaBrowser.Controller.Dlna;
using Emby.Dlna.Eventing;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
namespace Emby.Dlna.Service
{
diff --git a/Emby.Dlna/Ssdp/DeviceDiscovery.cs b/Emby.Dlna/Ssdp/DeviceDiscovery.cs
index a75e065c3..85dc4d94f 100644
--- a/Emby.Dlna/Ssdp/DeviceDiscovery.cs
+++ b/Emby.Dlna/Ssdp/DeviceDiscovery.cs
@@ -2,7 +2,7 @@
using MediaBrowser.Controller;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Controller.Dlna;
-using MediaBrowser.Model.Logging;
+using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
using System.Linq;