From f87454336e0bd1f5cb21353a2da116eacfd1adb9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 2 Oct 2013 10:14:10 -0400 Subject: [PATCH] fixed xml savers from running even with save local off --- .../Savers/AlbumXmlSaver.cs | 9 ++++----- .../Savers/ArtistXmlSaver.cs | 19 +++++++++---------- .../Savers/BoxSetXmlSaver.cs | 8 ++++---- .../Savers/EpisodeXmlSaver.cs | 8 ++++---- .../Savers/FolderXmlSaver.cs | 6 +++--- .../Savers/GameSystemXmlSaver.cs | 4 ++-- MediaBrowser.Providers/Savers/GameXmlSaver.cs | 6 +++--- .../Savers/MovieXmlSaver.cs | 4 ++-- .../Savers/PersonXmlSaver.cs | 6 +++--- .../Savers/SeasonXmlSaver.cs | 12 ++++++------ .../Savers/SeriesXmlSaver.cs | 4 ++-- 11 files changed, 42 insertions(+), 44 deletions(-) diff --git a/MediaBrowser.Providers/Savers/AlbumXmlSaver.cs b/MediaBrowser.Providers/Savers/AlbumXmlSaver.cs index bd63b5fbd..94f4571ee 100644 --- a/MediaBrowser.Providers/Savers/AlbumXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/AlbumXmlSaver.cs @@ -1,11 +1,10 @@ -using System.Collections.Generic; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Entities; using MediaBrowser.Providers.Movies; using System; +using System.Collections.Generic; using System.IO; using System.Text; using System.Threading; @@ -32,8 +31,8 @@ namespace MediaBrowser.Providers.Savers var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; - // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed - if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited) + // If new metadata has been downloaded and save local is on + if (_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) { return item is MusicAlbum; } diff --git a/MediaBrowser.Providers/Savers/ArtistXmlSaver.cs b/MediaBrowser.Providers/Savers/ArtistXmlSaver.cs index a27fb7363..55331db93 100644 --- a/MediaBrowser.Providers/Savers/ArtistXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/ArtistXmlSaver.cs @@ -1,15 +1,13 @@ -using System.Collections.Generic; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Library; -using MediaBrowser.Model.Entities; -using MediaBrowser.Providers.Movies; +using MediaBrowser.Providers.Music; using System; +using System.Collections.Generic; using System.IO; using System.Text; using System.Threading; -using MediaBrowser.Providers.Music; namespace MediaBrowser.Providers.Savers { @@ -30,9 +28,11 @@ namespace MediaBrowser.Providers.Savers /// true if [is enabled for] [the specified item]; otherwise, false. public bool IsEnabledFor(BaseItem item, ItemUpdateType updateType) { - // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed - if ((_config.Configuration.SaveLocalMeta && (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload) - || (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit) + var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; + var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; + + // If new metadata has been downloaded and save local is on + if (_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) { if (item is MusicArtist) { @@ -41,8 +41,7 @@ namespace MediaBrowser.Providers.Savers } // If new metadata has been downloaded or metadata was manually edited, proceed - if ((updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload - || (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit) + if (wasMetadataDownloaded || wasMetadataEdited) { if (item is Artist) { diff --git a/MediaBrowser.Providers/Savers/BoxSetXmlSaver.cs b/MediaBrowser.Providers/Savers/BoxSetXmlSaver.cs index f09b34570..cec6da64a 100644 --- a/MediaBrowser.Providers/Savers/BoxSetXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/BoxSetXmlSaver.cs @@ -1,10 +1,10 @@ -using System.Collections.Generic; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Movies; using MediaBrowser.Controller.Library; using MediaBrowser.Providers.Movies; using System; +using System.Collections.Generic; using System.IO; using System.Text; using System.Threading; @@ -31,8 +31,8 @@ namespace MediaBrowser.Providers.Savers var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; - // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed - if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited) + // If new metadata has been downloaded and save local is on + if (_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) { return item is BoxSet; } diff --git a/MediaBrowser.Providers/Savers/EpisodeXmlSaver.cs b/MediaBrowser.Providers/Savers/EpisodeXmlSaver.cs index 854c508b9..1b344d883 100644 --- a/MediaBrowser.Providers/Savers/EpisodeXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/EpisodeXmlSaver.cs @@ -1,11 +1,11 @@ -using System.Collections.Generic; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; using MediaBrowser.Controller.Persistence; using MediaBrowser.Providers.TV; using System; +using System.Collections.Generic; using System.Globalization; using System.IO; using System.Security; @@ -30,8 +30,8 @@ namespace MediaBrowser.Providers.Savers var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; - // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed - if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited) + // If new metadata has been downloaded and save local is on + if (_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) { return item is Episode; } diff --git a/MediaBrowser.Providers/Savers/FolderXmlSaver.cs b/MediaBrowser.Providers/Savers/FolderXmlSaver.cs index f98d27b45..8c19e2c28 100644 --- a/MediaBrowser.Providers/Savers/FolderXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/FolderXmlSaver.cs @@ -36,9 +36,9 @@ namespace MediaBrowser.Providers.Savers var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; - - // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed - if ((_config.Configuration.SaveLocalMeta && wasMetadataDownloaded) || wasMetadataEdited) + + // If new metadata has been downloaded and save local is on + if (_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) { if (!(item is Series) && !(item is BoxSet) && !(item is MusicArtist) && !(item is MusicAlbum) && !(item is Season)) diff --git a/MediaBrowser.Providers/Savers/GameSystemXmlSaver.cs b/MediaBrowser.Providers/Savers/GameSystemXmlSaver.cs index b2837fd58..724e3b1d9 100644 --- a/MediaBrowser.Providers/Savers/GameSystemXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/GameSystemXmlSaver.cs @@ -30,8 +30,8 @@ namespace MediaBrowser.Providers.Savers var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; - // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed - if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited) + // If new metadata has been downloaded and save local is on + if (_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) { return item is GameSystem; } diff --git a/MediaBrowser.Providers/Savers/GameXmlSaver.cs b/MediaBrowser.Providers/Savers/GameXmlSaver.cs index eae811d6d..5564b71ce 100644 --- a/MediaBrowser.Providers/Savers/GameXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/GameXmlSaver.cs @@ -35,8 +35,8 @@ namespace MediaBrowser.Providers.Savers var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; - // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed - if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited) + // If new metadata has been downloaded and save local is on + if (_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) { return item is Game; } @@ -69,7 +69,7 @@ namespace MediaBrowser.Providers.Savers { builder.Append("" + SecurityElement.Escape(game.GameSystem) + ""); } - + XmlSaverHelpers.AddCommonNodes(item, builder); builder.Append(""); diff --git a/MediaBrowser.Providers/Savers/MovieXmlSaver.cs b/MediaBrowser.Providers/Savers/MovieXmlSaver.cs index 9b34a4ebe..62820abbb 100644 --- a/MediaBrowser.Providers/Savers/MovieXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/MovieXmlSaver.cs @@ -39,8 +39,8 @@ namespace MediaBrowser.Providers.Savers var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; - // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed - if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited) + // If new metadata has been downloaded and save local is on + if (_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) { var trailer = item as Trailer; diff --git a/MediaBrowser.Providers/Savers/PersonXmlSaver.cs b/MediaBrowser.Providers/Savers/PersonXmlSaver.cs index 92f6db29b..50dab706e 100644 --- a/MediaBrowser.Providers/Savers/PersonXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/PersonXmlSaver.cs @@ -1,10 +1,10 @@ -using System.Collections.Generic; -using System.Security; -using MediaBrowser.Controller.Entities; +using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using MediaBrowser.Providers.Movies; using System; +using System.Collections.Generic; using System.IO; +using System.Security; using System.Text; using System.Threading; diff --git a/MediaBrowser.Providers/Savers/SeasonXmlSaver.cs b/MediaBrowser.Providers/Savers/SeasonXmlSaver.cs index e484b3d39..a2231ab74 100644 --- a/MediaBrowser.Providers/Savers/SeasonXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/SeasonXmlSaver.cs @@ -1,13 +1,13 @@ -using System; -using System.Collections.Generic; -using MediaBrowser.Controller.Configuration; +using MediaBrowser.Controller.Configuration; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.TV; using MediaBrowser.Controller.Library; +using MediaBrowser.Providers.TV; +using System; +using System.Collections.Generic; using System.IO; using System.Text; using System.Threading; -using MediaBrowser.Providers.TV; namespace MediaBrowser.Providers.Savers { @@ -31,8 +31,8 @@ namespace MediaBrowser.Providers.Savers var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; - // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed - if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited) + // If new metadata has been downloaded and save local is on + if (_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) { return item is Season; } diff --git a/MediaBrowser.Providers/Savers/SeriesXmlSaver.cs b/MediaBrowser.Providers/Savers/SeriesXmlSaver.cs index 8ccf23ddc..b955ac7c9 100644 --- a/MediaBrowser.Providers/Savers/SeriesXmlSaver.cs +++ b/MediaBrowser.Providers/Savers/SeriesXmlSaver.cs @@ -33,8 +33,8 @@ namespace MediaBrowser.Providers.Savers var wasMetadataEdited = (updateType & ItemUpdateType.MetadataEdit) == ItemUpdateType.MetadataEdit; var wasMetadataDownloaded = (updateType & ItemUpdateType.MetadataDownload) == ItemUpdateType.MetadataDownload; - // If new metadata has been downloaded and save local is on, OR metadata was manually edited, proceed - if ((_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) || wasMetadataEdited) + // If new metadata has been downloaded and save local is on + if (_config.Configuration.SaveLocalMeta && (wasMetadataEdited || wasMetadataDownloaded)) { return item is Series; }