From b79c1c7b0827844d79a62db2f7eca3125fa3d9ba Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 12 May 2013 19:36:42 -0400 Subject: [PATCH] fixed checking against wrong provider id --- .../Providers/Movies/FanArtMovieProvider.cs | 12 +++++----- .../Providers/TV/FanArtTVProvider.cs | 2 +- .../Providers/TV/RemoteEpisodeProvider.cs | 23 ++++++++----------- .../Providers/TV/RemoteSeasonProvider.cs | 3 ++- 4 files changed, 19 insertions(+), 21 deletions(-) diff --git a/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs b/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs index 3644f5633f..f44cdea1fe 100644 --- a/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs +++ b/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs @@ -119,12 +119,6 @@ namespace MediaBrowser.Controller.Providers.Movies { return false; } - - // Refresh if tmdb id has changed - if (providerInfo.Data != GetComparisonData(item.GetProviderId(MetadataProviders.Tmdb))) - { - return true; - } if (!ConfigurationManager.Configuration.DownloadMovieImages.Art && !ConfigurationManager.Configuration.DownloadMovieImages.Logo && @@ -136,6 +130,12 @@ namespace MediaBrowser.Controller.Providers.Movies return false; } + // Refresh if tmdb id has changed + if (providerInfo.Data != GetComparisonData(item.GetProviderId(MetadataProviders.Tmdb))) + { + return true; + } + return base.NeedsRefreshInternal(item, providerInfo); } diff --git a/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs b/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs index 33ebf62cc1..3bff6ca387 100644 --- a/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs +++ b/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs @@ -203,7 +203,7 @@ namespace MediaBrowser.Controller.Providers.TV } } - data.Data = GetComparisonData(item.GetProviderId(MetadataProviders.Tvcom)); + data.Data = GetComparisonData(item.GetProviderId(MetadataProviders.Tvdb)); SetLastRefreshed(series, DateTime.UtcNow, status); return true; diff --git a/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs index 487ea98cb8..f4ba98f70f 100644 --- a/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs +++ b/MediaBrowser.Controller/Providers/TV/RemoteEpisodeProvider.cs @@ -121,8 +121,8 @@ namespace MediaBrowser.Controller.Providers.TV if (seriesId != null) { - await FetchEpisodeData(episode, seriesId, cancellationToken).ConfigureAwait(false); - SetLastRefreshed(item, DateTime.UtcNow); + var status = await FetchEpisodeData(episode, seriesId, cancellationToken).ConfigureAwait(false); + SetLastRefreshed(item, DateTime.UtcNow, status); return true; } Logger.Info("Episode provider cannot determine Series Id for " + item.Path); @@ -140,18 +140,18 @@ namespace MediaBrowser.Controller.Providers.TV /// The series id. /// The cancellation token. /// Task{System.Boolean}. - private async Task FetchEpisodeData(Episode episode, string seriesId, CancellationToken cancellationToken) + private async Task FetchEpisodeData(Episode episode, string seriesId, CancellationToken cancellationToken) { - - string name = episode.Name; string location = episode.Path; string epNum = TVUtils.EpisodeNumberFromFile(location, episode.Season != null); + var status = ProviderRefreshStatus.Success; + if (epNum == null) { Logger.Warn("TvDbProvider: Could not determine episode number for: " + episode.Path); - return false; + return status; } var episodeNumber = Int32.Parse(epNum); @@ -159,7 +159,7 @@ namespace MediaBrowser.Controller.Providers.TV episode.IndexNumber = episodeNumber; var usingAbsoluteData = false; - if (string.IsNullOrEmpty(seriesId)) return false; + if (string.IsNullOrEmpty(seriesId)) return status; var seasonNumber = ""; if (episode.Parent is Season) @@ -240,10 +240,7 @@ namespace MediaBrowser.Controller.Providers.TV } catch (HttpException) { - } - catch (IOException) - { - + status = ProviderRefreshStatus.CompletedWithErrors; } } @@ -303,12 +300,12 @@ namespace MediaBrowser.Controller.Providers.TV await _providerManager.SaveToLibraryFilesystem(episode, Path.Combine(episode.MetaLocation, Path.GetFileNameWithoutExtension(episode.Path) + ".xml"), ms, cancellationToken).ConfigureAwait(false); } - return true; + return status; } } - return false; + return status; } /// diff --git a/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs index b9f3c01349..e2013fb876 100644 --- a/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs +++ b/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs @@ -55,7 +55,8 @@ namespace MediaBrowser.Controller.Providers.TV /// The priority. public override MetadataProviderPriority Priority { - get { return MetadataProviderPriority.Second; } + // Run after fanart + get { return MetadataProviderPriority.Fourth; } } ///