mirror of
https://github.com/Radarr/Radarr
synced 2025-01-03 05:44:50 +00:00
Speed up and reduce meta calls for Imdb Lists when mapping
This commit is contained in:
parent
eae9a6d6e0
commit
3c41c84fb0
3 changed files with 24 additions and 5 deletions
|
@ -327,6 +327,13 @@ public MovieMetadata MapMovieToTmdbMovie(MovieMetadata movie)
|
|||
}
|
||||
else if (movie.ImdbId.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
newMovie = _movieMetadataService.FindByImdbId(Parser.Parser.NormalizeImdbId(movie.ImdbId));
|
||||
|
||||
if (newMovie != null)
|
||||
{
|
||||
return newMovie;
|
||||
}
|
||||
|
||||
newMovie = GetMovieByImdbId(movie.ImdbId);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -11,6 +11,7 @@ namespace NzbDrone.Core.Movies
|
|||
public interface IMovieMetadataRepository : IBasicRepository<MovieMetadata>
|
||||
{
|
||||
MovieMetadata FindByTmdbId(int tmdbId);
|
||||
MovieMetadata FindByImdbId(string imdbId);
|
||||
List<MovieMetadata> FindById(List<int> tmdbIds);
|
||||
List<MovieMetadata> GetMoviesWithCollections();
|
||||
List<MovieMetadata> GetMoviesByCollectionTmdbId(int collectionId);
|
||||
|
@ -27,9 +28,14 @@ public MovieMetadataRepository(IMainDatabase database, IEventAggregator eventAgg
|
|||
_logger = logger;
|
||||
}
|
||||
|
||||
public MovieMetadata FindByTmdbId(int tmdbid)
|
||||
public MovieMetadata FindByTmdbId(int tmdbId)
|
||||
{
|
||||
return Query(x => x.TmdbId == tmdbid).FirstOrDefault();
|
||||
return Query(x => x.TmdbId == tmdbId).FirstOrDefault();
|
||||
}
|
||||
|
||||
public MovieMetadata FindByImdbId(string imdbId)
|
||||
{
|
||||
return Query(x => x.ImdbId == imdbId).FirstOrDefault();
|
||||
}
|
||||
|
||||
public List<MovieMetadata> FindById(List<int> tmdbIds)
|
||||
|
|
|
@ -5,7 +5,8 @@ namespace NzbDrone.Core.Movies
|
|||
public interface IMovieMetadataService
|
||||
{
|
||||
MovieMetadata Get(int id);
|
||||
MovieMetadata FindByTmdbId(int tmdbid);
|
||||
MovieMetadata FindByTmdbId(int tmdbId);
|
||||
MovieMetadata FindByImdbId(string imdbId);
|
||||
List<MovieMetadata> GetMoviesWithCollections();
|
||||
List<MovieMetadata> GetMoviesByCollectionTmdbId(int collectionId);
|
||||
bool Upsert(MovieMetadata movie);
|
||||
|
@ -21,9 +22,14 @@ public MovieMetadataService(IMovieMetadataRepository movieMetadataRepository)
|
|||
_movieMetadataRepository = movieMetadataRepository;
|
||||
}
|
||||
|
||||
public MovieMetadata FindByTmdbId(int tmdbid)
|
||||
public MovieMetadata FindByTmdbId(int tmdbId)
|
||||
{
|
||||
return _movieMetadataRepository.FindByTmdbId(tmdbid);
|
||||
return _movieMetadataRepository.FindByTmdbId(tmdbId);
|
||||
}
|
||||
|
||||
public MovieMetadata FindByImdbId(string imdbId)
|
||||
{
|
||||
return _movieMetadataRepository.FindByImdbId(imdbId);
|
||||
}
|
||||
|
||||
public List<MovieMetadata> GetMoviesWithCollections()
|
||||
|
|
Loading…
Reference in a new issue