diff options
Diffstat (limited to 'Emby.Dlna/PlayTo')
| -rw-r--r-- | Emby.Dlna/PlayTo/Device.cs | 18 | ||||
| -rw-r--r-- | Emby.Dlna/PlayTo/PlayToController.cs | 32 | ||||
| -rw-r--r-- | Emby.Dlna/PlayTo/PlayToManager.cs | 12 |
3 files changed, 26 insertions, 36 deletions
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("&", "&"); - _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); } } |
