From 38a771782453a40325b7653823456d44c987e594 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 9 Jun 2013 21:40:28 -0400 Subject: [PATCH] ease up on RefreshOnFileSystemStampChange --- .../MediaInfo/FFProbeVideoInfoProvider.cs | 1 + .../Movies/MovieDbProvider.cs | 22 ---------------- .../Music/LastfmAlbumProvider.cs | 15 +++++------ .../Music/LastfmArtistProvider.cs | 5 ++++ .../Music/LastfmBaseProvider.cs | 26 ------------------- .../TV/EpisodeProviderFromXml.cs | 8 ------ .../TV/RemoteEpisodeProvider.cs | 6 +++-- .../TV/RemoteSeriesProvider.cs | 4 +-- 8 files changed, 18 insertions(+), 69 deletions(-) diff --git a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs index f8f8cdb09d..5f24aa1e04 100644 --- a/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs +++ b/MediaBrowser.Providers/MediaInfo/FFProbeVideoInfoProvider.cs @@ -60,6 +60,7 @@ namespace MediaBrowser.Providers.MediaInfo { get { + // Need this in case external subtitle files change return true; } } diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index 5e23ca7d65..b25a61c4eb 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -116,17 +116,6 @@ namespace MediaBrowser.Providers.Movies } } - /// - /// If we save locally, refresh if they delete something - /// - protected override bool RefreshOnFileSystemStampChange - { - get - { - return ConfigurationManager.Configuration.SaveLocalMeta; - } - } - protected override bool RefreshOnVersionChange { get @@ -274,17 +263,6 @@ namespace MediaBrowser.Providers.Movies return true; } - /// - /// Determines whether [has local meta] [the specified item]. - /// - /// The item. - /// true if [has local meta] [the specified item]; otherwise, false. - private bool HasLocalMeta(BaseItem item) - { - //need at least the xml and folder.jpg/png or a movie.xml put in by someone else - return item.LocationType == LocationType.FileSystem && item.ResolveArgs.ContainsMetaFileByName(LocalMetaFileName); - } - /// /// Determines whether [has alt meta] [the specified item]. /// diff --git a/MediaBrowser.Providers/Music/LastfmAlbumProvider.cs b/MediaBrowser.Providers/Music/LastfmAlbumProvider.cs index b48a2c9e37..af277b5fcc 100644 --- a/MediaBrowser.Providers/Music/LastfmAlbumProvider.cs +++ b/MediaBrowser.Providers/Music/LastfmAlbumProvider.cs @@ -21,7 +21,12 @@ namespace MediaBrowser.Providers.Music private static readonly Task BlankId = Task.FromResult(""); private readonly IProviderManager _providerManager; - + + /// + /// The name of the local json meta file for this item type + /// + protected string LocalMetaFileName { get; set; } + public LastfmAlbumProvider(IJsonSerializer jsonSerializer, IHttpClient httpClient, ILogManager logManager, IServerConfigurationManager configurationManager, IProviderManager providerManager) : base(jsonSerializer, httpClient, logManager, configurationManager) { @@ -132,14 +137,6 @@ namespace MediaBrowser.Providers.Music return item is MusicAlbum; } - protected override bool RefreshOnFileSystemStampChange - { - get - { - return true; - } - } - /// /// Gets the data. /// diff --git a/MediaBrowser.Providers/Music/LastfmArtistProvider.cs b/MediaBrowser.Providers/Music/LastfmArtistProvider.cs index aff6f1df9d..0281b8c0b1 100644 --- a/MediaBrowser.Providers/Music/LastfmArtistProvider.cs +++ b/MediaBrowser.Providers/Music/LastfmArtistProvider.cs @@ -35,6 +35,11 @@ namespace MediaBrowser.Providers.Music /// protected readonly ILibraryManager LibraryManager; + /// + /// The name of the local json meta file for this item type + /// + protected string LocalMetaFileName { get; set; } + /// /// Initializes a new instance of the class. /// diff --git a/MediaBrowser.Providers/Music/LastfmBaseProvider.cs b/MediaBrowser.Providers/Music/LastfmBaseProvider.cs index b90dc94539..765911383b 100644 --- a/MediaBrowser.Providers/Music/LastfmBaseProvider.cs +++ b/MediaBrowser.Providers/Music/LastfmBaseProvider.cs @@ -71,11 +71,6 @@ namespace MediaBrowser.Providers.Music /// The HTTP client. protected IHttpClient HttpClient { get; private set; } - /// - /// The name of the local json meta file for this item type - /// - protected string LocalMetaFileName { get; set; } - protected virtual bool SaveLocalMeta { get @@ -84,17 +79,6 @@ namespace MediaBrowser.Providers.Music } } - /// - /// If we save locally, refresh if they delete something - /// - protected override bool RefreshOnFileSystemStampChange - { - get - { - return SaveLocalMeta; - } - } - /// /// Gets the priority. /// @@ -119,16 +103,6 @@ namespace MediaBrowser.Providers.Music protected const string RootUrl = @"http://ws.audioscrobbler.com/2.0/?"; protected static string ApiKey = "7b76553c3eb1d341d642755aecc40a33"; - /// - /// Determines whether [has local meta] [the specified item]. - /// - /// The item. - /// true if [has local meta] [the specified item]; otherwise, false. - protected bool HasLocalMeta(BaseItem item) - { - return item.ResolveArgs.ContainsMetaFileByName(LocalMetaFileName); - } - /// /// Fetches the items data. /// diff --git a/MediaBrowser.Providers/TV/EpisodeProviderFromXml.cs b/MediaBrowser.Providers/TV/EpisodeProviderFromXml.cs index eb549759a8..bbfa0a3bf4 100644 --- a/MediaBrowser.Providers/TV/EpisodeProviderFromXml.cs +++ b/MediaBrowser.Providers/TV/EpisodeProviderFromXml.cs @@ -40,14 +40,6 @@ namespace MediaBrowser.Providers.TV get { return MetadataProviderPriority.First; } } - protected override bool RefreshOnFileSystemStampChange - { - get - { - return true; - } - } - /// /// Fetches metadata and returns true or false indicating if any work that requires persistence was done /// diff --git a/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs b/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs index 5aac3e0754..f849d85ec0 100644 --- a/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/RemoteEpisodeProvider.cs @@ -121,7 +121,8 @@ namespace MediaBrowser.Providers.TV /// true if XXXX, false otherwise protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo) { - if (HasLocalMeta(item)) + // Don't proceed if there's local metadata and save local is off, as it's likely from another source + if (HasLocalMeta(item) && !ConfigurationManager.Configuration.SaveLocalMeta) { return false; } @@ -181,7 +182,8 @@ namespace MediaBrowser.Providers.TV /// Task{System.Boolean}. public override async Task FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken) { - if (HasLocalMeta(item)) + // Don't proceed if there's local metadata and save local is off, as it's likely from another source + if (HasLocalMeta(item) && !ConfigurationManager.Configuration.SaveLocalMeta) { return false; } diff --git a/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs b/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs index acabc3a991..96f0c5178a 100644 --- a/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs +++ b/MediaBrowser.Providers/TV/RemoteSeriesProvider.cs @@ -272,8 +272,8 @@ namespace MediaBrowser.Providers.TV await DownloadSeriesZip(seriesId, seriesDataPath, cancellationToken).ConfigureAwait(false); } - // Only examine the main info if there's no local metadata - if (!HasLocalMeta(series)) + // Examine if there's no local metadata, or save local is on (to get updates) + if (!HasLocalMeta(series) || ConfigurationManager.Configuration.SaveLocalMeta) { var seriesXmlPath = Path.Combine(seriesDataPath, seriesXmlFilename); var actorsXmlPath = Path.Combine(seriesDataPath, "actors.xml");