diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs index 1d629b21d4..01f532bae2 100644 --- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs @@ -247,8 +247,19 @@ namespace MediaBrowser.Providers.Movies /// Task. private async Task FetchMovieData(BaseItem item, CancellationToken cancellationToken) { - string id = item.GetProviderId(MetadataProviders.Tmdb) ?? await FindId(item, item.ProductionYear, cancellationToken).ConfigureAwait(false); - if (id != null) + var id = item.GetProviderId(MetadataProviders.Tmdb); + + if (string.IsNullOrEmpty(id)) + { + id = item.GetProviderId(MetadataProviders.Imdb); + } + + if (string.IsNullOrEmpty(id)) + { + id = await FindId(item, cancellationToken).ConfigureAwait(false); + } + + if (!string.IsNullOrEmpty(id)) { Logger.Debug("MovieDbProvider - getting movie info with id: " + id); @@ -290,19 +301,15 @@ namespace MediaBrowser.Providers.Movies /// Finds the id. /// /// The item. - /// The production year. /// The cancellation token /// Task{System.String}. - public async Task FindId(BaseItem item, int? productionYear, CancellationToken cancellationToken) + public async Task FindId(BaseItem item, CancellationToken cancellationToken) { - int? year; + int? yearInName; string name = item.Name; - ParseName(name, out name, out year); + ParseName(name, out name, out yearInName); - if (year == null && productionYear != null) - { - year = productionYear; - } + var year = item.ProductionYear ?? yearInName; Logger.Info("MovieDbProvider: Finding id for movie: " + name); string language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();