aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-08-24 00:30:45 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-08-24 00:30:45 -0400
commit79a82ae671628f73a6dacd5063667ff87900435d (patch)
treec1077fb18addc68c9c6f2058c002c50757876bae
parente7d8e7fae0d202a43a0eab852456190fd388b20b (diff)
fixes #425 - Support searching tmdb using imdb id
-rw-r--r--MediaBrowser.Providers/Movies/MovieDbProvider.cs27
1 files changed, 17 insertions, 10 deletions
diff --git a/MediaBrowser.Providers/Movies/MovieDbProvider.cs b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
index 1d629b21d..01f532bae 100644
--- a/MediaBrowser.Providers/Movies/MovieDbProvider.cs
+++ b/MediaBrowser.Providers/Movies/MovieDbProvider.cs
@@ -247,8 +247,19 @@ namespace MediaBrowser.Providers.Movies
/// <returns>Task.</returns>
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.
/// </summary>
/// <param name="item">The item.</param>
- /// <param name="productionYear">The production year.</param>
/// <param name="cancellationToken">The cancellation token</param>
/// <returns>Task{System.String}.</returns>
- public async Task<string> FindId(BaseItem item, int? productionYear, CancellationToken cancellationToken)
+ public async Task<string> 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();