diff --git a/src/Ombi.Schedule/Jobs/Ombi/RefreshMetadata.cs b/src/Ombi.Schedule/Jobs/Ombi/RefreshMetadata.cs index 30878adaf..f7d9ae1d2 100644 --- a/src/Ombi.Schedule/Jobs/Ombi/RefreshMetadata.cs +++ b/src/Ombi.Schedule/Jobs/Ombi/RefreshMetadata.cs @@ -128,7 +128,7 @@ namespace Ombi.Schedule.Jobs.Ombi if (!hasImdb) { - var id = await GetImdbId(hasTheMovieDb, hasTvDbId, show.Title, show.TheMovieDbId, show.TvDbId); + var id = await GetImdbId(hasTheMovieDb, hasTvDbId, show.Title, show.TheMovieDbId, show.TvDbId, RequestType.TvShow); show.ImdbId = id; _plexRepo.UpdateWithoutSave(show); } @@ -162,7 +162,7 @@ namespace Ombi.Schedule.Jobs.Ombi if (!hasImdb) { - var id = await GetImdbId(hasTheMovieDb, hasTvDbId, show.Title, show.TheMovieDbId, show.TvDbId); + var id = await GetImdbId(hasTheMovieDb, hasTvDbId, show.Title, show.TheMovieDbId, show.TvDbId, RequestType.TvShow); show.ImdbId = id; _embyRepo.UpdateWithoutSave(show); } @@ -193,7 +193,7 @@ namespace Ombi.Schedule.Jobs.Ombi if (!hasImdb) { - var imdbId = await GetImdbId(hasTheMovieDb, false, movie.Title, movie.TheMovieDbId, string.Empty); + var imdbId = await GetImdbId(hasTheMovieDb, false, movie.Title, movie.TheMovieDbId, string.Empty, RequestType.Movie); movie.ImdbId = imdbId; _plexRepo.UpdateWithoutSave(movie); } @@ -247,7 +247,7 @@ namespace Ombi.Schedule.Jobs.Ombi if (!movie.HasImdb) { - var imdbId = await GetImdbId(movie.HasTheMovieDb, false, movie.Title, movie.TheMovieDbId, string.Empty); + var imdbId = await GetImdbId(movie.HasTheMovieDb, false, movie.Title, movie.TheMovieDbId, string.Empty, RequestType.Movie); movie.ImdbId = imdbId; _embyRepo.UpdateWithoutSave(movie); } @@ -305,7 +305,7 @@ namespace Ombi.Schedule.Jobs.Ombi return string.Empty; } - private async Task GetImdbId(bool hasTheMovieDb, bool hasTvDbId, string title, string theMovieDbId, string tvDbId) + private async Task GetImdbId(bool hasTheMovieDb, bool hasTvDbId, string title, string theMovieDbId, string tvDbId, RequestType type) { _log.LogInformation("The media item {0} does not have a ImdbId, searching for ImdbId", title); // Looks like TV Maze does not provide the moviedb id, neither does the TV endpoint on TheMovieDb @@ -314,13 +314,22 @@ namespace Ombi.Schedule.Jobs.Ombi _log.LogInformation("The show {0} has TheMovieDbId but not ImdbId, searching for ImdbId", title); if (int.TryParse(theMovieDbId, out var id)) { - var result = await _movieApi.GetTvExternals(id); - - return result.imdb_id; + switch (type) + { + case RequestType.TvShow: + var result = await _movieApi.GetTvExternals(id); + return result.imdb_id; + case RequestType.Movie: + var r = await _movieApi.GetMovieInformationWithExtraInfo(id); + return r.ImdbId; + default: + break; + } + } } - if (hasTvDbId) + if (hasTvDbId && type == RequestType.TvShow) { _log.LogInformation("The show {0} has tvdbid but not ImdbId, searching for ImdbId", title); if (int.TryParse(tvDbId, out var id))