From bf01918659986cc6cbaefaebb67f607aeb1b4400 Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Thu, 20 Dec 2018 11:38:42 +0100 Subject: [PATCH] Clean up --- Emby.IsoMounting/IsoMounter/LinuxMount.cs | 2 - .../LiveTv/LiveTvManager.cs | 6 +-- MediaBrowser.Api/LiveTv/LiveTvService.cs | 1 - .../UserLibrary/PlaystateService.cs | 4 +- MediaBrowser.Controller/Entities/Folder.cs | 42 ++++++++----------- 5 files changed, 20 insertions(+), 35 deletions(-) diff --git a/Emby.IsoMounting/IsoMounter/LinuxMount.cs b/Emby.IsoMounting/IsoMounter/LinuxMount.cs index a08a123921..edd26f08d4 100644 --- a/Emby.IsoMounting/IsoMounter/LinuxMount.cs +++ b/Emby.IsoMounting/IsoMounter/LinuxMount.cs @@ -1,7 +1,5 @@ using System; using MediaBrowser.Model.IO; -using Microsoft.Extensions.Logging; -using MediaBrowser.Model.System; namespace IsoMounter { diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index d74636e8de..679f8668b4 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Common; -using MediaBrowser.Common.Configuration; +using MediaBrowser.Common.Configuration; using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Progress; using MediaBrowser.Controller.Configuration; @@ -18,9 +17,7 @@ using Microsoft.Extensions.Logging; using MediaBrowser.Model.Querying; using MediaBrowser.Model.Serialization; using System; -using System.Collections.Concurrent; using System.Collections.Generic; -using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -29,7 +26,6 @@ using MediaBrowser.Common.Events; using MediaBrowser.Common.Security; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Entities.TV; -using MediaBrowser.Controller.IO; using MediaBrowser.Model.Events; using MediaBrowser.Model.Extensions; using MediaBrowser.Model.Globalization; diff --git a/MediaBrowser.Api/LiveTv/LiveTvService.cs b/MediaBrowser.Api/LiveTv/LiveTvService.cs index 06c0c6862c..ef9ce9aec7 100644 --- a/MediaBrowser.Api/LiveTv/LiveTvService.cs +++ b/MediaBrowser.Api/LiveTv/LiveTvService.cs @@ -17,7 +17,6 @@ using System.Threading; using System.Threading.Tasks; using MediaBrowser.Api.UserLibrary; using MediaBrowser.Model.IO; -using MediaBrowser.Controller.IO; using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Model.Services; diff --git a/MediaBrowser.Api/UserLibrary/PlaystateService.cs b/MediaBrowser.Api/UserLibrary/PlaystateService.cs index 2c514a1097..9b269542a8 100644 --- a/MediaBrowser.Api/UserLibrary/PlaystateService.cs +++ b/MediaBrowser.Api/UserLibrary/PlaystateService.cs @@ -6,9 +6,9 @@ using MediaBrowser.Model.Dto; using MediaBrowser.Model.Session; using System; using System.Globalization; -using System.Linq; using System.Threading.Tasks; using MediaBrowser.Model.Services; +using Microsoft.Extensions.Logging; namespace MediaBrowser.Api.UserLibrary { @@ -381,7 +381,7 @@ namespace MediaBrowser.Api.UserLibrary public void Post(ReportPlaybackStopped request) { - Logger.Debug("ReportPlaybackStopped PlaySessionId: {0}", request.PlaySessionId ?? string.Empty); + Logger.LogDebug("ReportPlaybackStopped PlaySessionId: {0}", request.PlaySessionId ?? string.Empty); if (!string.IsNullOrWhiteSpace(request.PlaySessionId)) { diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 3d830cbe62..e9352ce400 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -371,6 +371,7 @@ namespace MediaBrowser.Controller.Entities } catch (Exception ex) { + Logger.LogError(ex, "Error retrieving children folder"); return; } @@ -419,11 +420,7 @@ namespace MediaBrowser.Controller.Entities foreach (var item in itemsRemoved) { - if (!item.IsFileProtocol) - { - } - - else + if (item.IsFileProtocol) { Logger.LogDebug("Removed item: " + item.Path); @@ -571,14 +568,9 @@ namespace MediaBrowser.Controller.Entities await child.RefreshMetadata(refreshOptions, cancellationToken).ConfigureAwait(false); } - if (recursive) + if (recursive && child is Folder folder) { - var folder = child as Folder; - - if (folder != null) - { - await folder.RefreshMetadataRecursive(folder.Children.ToList(), refreshOptions, true, progress, cancellationToken); - } + await folder.RefreshMetadataRecursive(folder.Children.ToList(), refreshOptions, true, progress, cancellationToken); } } } @@ -782,7 +774,7 @@ namespace MediaBrowser.Controller.Entities { if (query.IncludeItemTypes.Length == 1 && string.Equals(query.IncludeItemTypes[0], typeof(BoxSet).Name, StringComparison.OrdinalIgnoreCase)) { - Logger.Debug("Query requires post-filtering due to BoxSet query"); + Logger.LogDebug("Query requires post-filtering due to BoxSet query"); return true; } @@ -803,44 +795,44 @@ namespace MediaBrowser.Controller.Entities // Filter by Video3DFormat if (query.Is3D.HasValue) { - Logger.Debug("Query requires post-filtering due to Is3D"); + Logger.LogDebug("Query requires post-filtering due to Is3D"); return true; } if (query.HasOfficialRating.HasValue) { - Logger.Debug("Query requires post-filtering due to HasOfficialRating"); + Logger.LogDebug("Query requires post-filtering due to HasOfficialRating"); return true; } if (query.IsPlaceHolder.HasValue) { - Logger.Debug("Query requires post-filtering due to IsPlaceHolder"); + Logger.LogDebug("Query requires post-filtering due to IsPlaceHolder"); return true; } if (query.HasSpecialFeature.HasValue) { - Logger.Debug("Query requires post-filtering due to HasSpecialFeature"); + Logger.LogDebug("Query requires post-filtering due to HasSpecialFeature"); return true; } if (query.HasSubtitles.HasValue) { - Logger.Debug("Query requires post-filtering due to HasSubtitles"); + Logger.LogDebug("Query requires post-filtering due to HasSubtitles"); return true; } if (query.HasTrailer.HasValue) { - Logger.Debug("Query requires post-filtering due to HasTrailer"); + Logger.LogDebug("Query requires post-filtering due to HasTrailer"); return true; } // Filter by VideoType if (query.VideoTypes.Length > 0) { - Logger.Debug("Query requires post-filtering due to VideoTypes"); + Logger.LogDebug("Query requires post-filtering due to VideoTypes"); return true; } @@ -852,19 +844,19 @@ namespace MediaBrowser.Controller.Entities if (!string.IsNullOrEmpty(query.AdjacentTo)) { - Logger.Debug("Query requires post-filtering due to AdjacentTo"); + Logger.LogDebug("Query requires post-filtering due to AdjacentTo"); return true; } if (query.SeriesStatuses.Length > 0) { - Logger.Debug("Query requires post-filtering due to SeriesStatuses"); + Logger.LogDebug("Query requires post-filtering due to SeriesStatuses"); return true; } if (query.AiredDuringSeason.HasValue) { - Logger.Debug("Query requires post-filtering due to AiredDuringSeason"); + Logger.LogDebug("Query requires post-filtering due to AiredDuringSeason"); return true; } @@ -872,7 +864,7 @@ namespace MediaBrowser.Controller.Entities { if (query.IncludeItemTypes.Length == 1 && query.IncludeItemTypes.Contains(typeof(Series).Name)) { - Logger.Debug("Query requires post-filtering due to IsPlayed"); + Logger.LogDebug("Query requires post-filtering due to IsPlayed"); return true; } } @@ -1594,7 +1586,7 @@ namespace MediaBrowser.Controller.Entities } catch (IOException ex) { - Logger.LogError("Error resolving shortcut {0}", ex, i.FullName); + Logger.LogError(ex, "Error resolving shortcut {0}", i.FullName); return null; } })