diff --git a/src/NzbDrone.Core.Test/IndexerSearchTests/ReleaseSearchServiceFixture.cs b/src/NzbDrone.Core.Test/IndexerSearchTests/ReleaseSearchServiceFixture.cs index d253e9157..03bb0bb64 100644 --- a/src/NzbDrone.Core.Test/IndexerSearchTests/ReleaseSearchServiceFixture.cs +++ b/src/NzbDrone.Core.Test/IndexerSearchTests/ReleaseSearchServiceFixture.cs @@ -45,7 +45,7 @@ namespace NzbDrone.Core.Test.IndexerSearchTests .Returns(_movie); Mocker.GetMock() - .Setup(s => s.GetAllTranslationsForMovie(It.IsAny())) + .Setup(s => s.GetAllTranslationsForMovieMetadata(It.IsAny())) .Returns(new List()); } diff --git a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs index f24756c5b..3ac3761ce 100644 --- a/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs +++ b/src/NzbDrone.Core.Test/OrganizerTests/FileNameBuilderTests/FileNameBuilderFixture.cs @@ -70,7 +70,7 @@ namespace NzbDrone.Core.Test.OrganizerTests.FileNameBuilderTests .Returns(new List()); Mocker.GetMock() - .Setup(v => v.GetAllTranslationsForMovie(It.IsAny())) + .Setup(v => v.GetAllTranslationsForMovieMetadata(It.IsAny())) .Returns(_movieTranslations); } diff --git a/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs b/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs index 61c151d0d..6f427e232 100644 --- a/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs +++ b/src/NzbDrone.Core/Extras/Metadata/Consumers/Xbmc/XbmcMetadata.cs @@ -126,11 +126,11 @@ namespace NzbDrone.Core.Extras.Metadata.Consumers.Xbmc (int)movie.MovieMetadata.Value.OriginalLanguage : Settings.MovieMetadataLanguage; - var movieTranslations = _movieTranslationsService.GetAllTranslationsForMovie(movie.Id); + var movieTranslations = _movieTranslationsService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId); var selectedSettingsLanguage = Language.FindById(movieMetadataLanguage); var movieTranslation = movieTranslations.FirstOrDefault(mt => mt.Language == selectedSettingsLanguage); - var credits = _creditService.GetAllCreditsForMovie(movie.MovieMetadataId); + var credits = _creditService.GetAllCreditsForMovieMetadata(movie.MovieMetadataId); var watched = GetExistingWatchedStatus(movie, movieFile.RelativePath); diff --git a/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs b/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs index b22f66389..6571cd9f8 100644 --- a/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs +++ b/src/NzbDrone.Core/IndexerSearch/ReleaseSearchService.cs @@ -49,7 +49,7 @@ namespace NzbDrone.Core.IndexerSearch public List MovieSearch(int movieId, bool userInvokedSearch, bool interactiveSearch) { var movie = _movieService.GetMovie(movieId); - movie.MovieMetadata.Value.Translations = _movieTranslationService.GetAllTranslationsForMovie(movie.Id); + movie.MovieMetadata.Value.Translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId); return MovieSearch(movie, userInvokedSearch, interactiveSearch); } @@ -77,7 +77,7 @@ namespace NzbDrone.Core.IndexerSearch }; var wantedLanguages = _profileService.GetAcceptableLanguages(movie.ProfileId); - var translations = _movieTranslationService.GetAllTranslationsForMovie(movie.Id); + var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId); var queryTranlations = new List { diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index 72f9e2827..c1adda9b7 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -464,7 +464,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook } else { - movie.MovieMetadata.Value.Translations = _movieTranslationService.GetAllTranslationsForMovie(movie.MovieMetadataId); + movie.MovieMetadata.Value.Translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId); } return movie; diff --git a/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitleService.cs b/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitleService.cs index b25711a9c..e0fff47f5 100644 --- a/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitleService.cs +++ b/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitleService.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Movies.AlternativeTitles { public interface IAlternativeTitleService { - List GetAllTitlesForMovie(int movieId); + List GetAllTitlesForMovieMetadata(int movieMetadataId); AlternativeTitle AddAltTitle(AlternativeTitle title, MovieMetadata movie); List AddAltTitles(List titles, MovieMetadata movie); AlternativeTitle GetById(int id); @@ -36,9 +36,9 @@ namespace NzbDrone.Core.Movies.AlternativeTitles _logger = logger; } - public List GetAllTitlesForMovie(int movieId) + public List GetAllTitlesForMovieMetadata(int movieMetadataId) { - return _titleRepo.FindByMovieMetadataId(movieId).ToList(); + return _titleRepo.FindByMovieMetadataId(movieMetadataId).ToList(); } public AlternativeTitle AddAltTitle(AlternativeTitle title, MovieMetadata movie) @@ -69,15 +69,15 @@ namespace NzbDrone.Core.Movies.AlternativeTitles _titleRepo.Delete(title); } - public List UpdateTitles(List titles, MovieMetadata movie) + public List UpdateTitles(List titles, MovieMetadata movieMetadata) { - int movieId = movie.Id; + int movieMetadataId = movieMetadata.Id; // First update the movie ids so we can correlate them later. - titles.ForEach(t => t.MovieMetadataId = movieId); + titles.ForEach(t => t.MovieMetadataId = movieMetadataId); // Then make sure none of them are the same as the main title. - titles = titles.Where(t => t.CleanTitle != movie.CleanTitle).ToList(); + titles = titles.Where(t => t.CleanTitle != movieMetadata.CleanTitle).ToList(); // Then make sure they are all distinct titles titles = titles.DistinctBy(t => t.CleanTitle).ToList(); @@ -86,7 +86,7 @@ namespace NzbDrone.Core.Movies.AlternativeTitles titles = titles.Where(t => !_titleRepo.All().Any(e => e.CleanTitle == t.CleanTitle && e.MovieMetadataId != t.MovieMetadataId)).ToList(); // Now find titles to delete, update and insert. - var existingTitles = _titleRepo.FindByMovieMetadataId(movieId); + var existingTitles = _titleRepo.FindByMovieMetadataId(movieMetadataId); var insert = titles.Where(t => !existingTitles.Contains(t)); var update = existingTitles.Where(t => titles.Contains(t)); diff --git a/src/NzbDrone.Core/Movies/Credits/CreditService.cs b/src/NzbDrone.Core/Movies/Credits/CreditService.cs index a094886bb..724b560a5 100644 --- a/src/NzbDrone.Core/Movies/Credits/CreditService.cs +++ b/src/NzbDrone.Core/Movies/Credits/CreditService.cs @@ -8,7 +8,7 @@ namespace NzbDrone.Core.Movies.Credits { public interface ICreditService { - List GetAllCreditsForMovie(int movieId); + List GetAllCreditsForMovieMetadata(int movieMetadataId); Credit AddCredit(Credit credit, MovieMetadata movie); List AddCredits(List credits, MovieMetadata movie); Credit GetById(int id); @@ -25,9 +25,9 @@ namespace NzbDrone.Core.Movies.Credits _creditRepo = creditRepo; } - public List GetAllCreditsForMovie(int movieId) + public List GetAllCreditsForMovieMetadata(int movieMetadataId) { - return _creditRepo.FindByMovieMetadataId(movieId).ToList(); + return _creditRepo.FindByMovieMetadataId(movieMetadataId).ToList(); } public Credit AddCredit(Credit credit, MovieMetadata movie) @@ -58,15 +58,15 @@ namespace NzbDrone.Core.Movies.Credits _creditRepo.Delete(credit); } - public List UpdateCredits(List credits, MovieMetadata movie) + public List UpdateCredits(List credits, MovieMetadata movieMetadata) { - int movieId = movie.Id; + int movieMetadataId = movieMetadata.Id; // First update the movie ids so we can correlate them later. - credits.ForEach(t => t.MovieMetadataId = movieId); + credits.ForEach(t => t.MovieMetadataId = movieMetadataId); // Now find credits to delete, update and insert. - var existingCredits = _creditRepo.FindByMovieMetadataId(movieId); + var existingCredits = _creditRepo.FindByMovieMetadataId(movieMetadataId); // Should never have multiple credits with same credit_id, but check to ensure incase TMDB is on fritz var dupeFreeCredits = credits.DistinctBy(m => m.CreditTmdbId).ToList(); diff --git a/src/NzbDrone.Core/Movies/Translations/MovieTranslationRepository.cs b/src/NzbDrone.Core/Movies/Translations/MovieTranslationRepository.cs index aae9b818e..2ed120b85 100644 --- a/src/NzbDrone.Core/Movies/Translations/MovieTranslationRepository.cs +++ b/src/NzbDrone.Core/Movies/Translations/MovieTranslationRepository.cs @@ -7,7 +7,7 @@ namespace NzbDrone.Core.Movies.Translations { public interface IMovieTranslationRepository : IBasicRepository { - List FindByMovieMetadataId(int movieId); + List FindByMovieMetadataId(int movieMetadataId); List FindByLanguage(Language language); void DeleteForMovies(List movieIds); } @@ -19,9 +19,9 @@ namespace NzbDrone.Core.Movies.Translations { } - public List FindByMovieMetadataId(int movieId) + public List FindByMovieMetadataId(int movieMetadataId) { - return Query(x => x.MovieMetadataId == movieId); + return Query(x => x.MovieMetadataId == movieMetadataId); } public List FindByLanguage(Language language) diff --git a/src/NzbDrone.Core/Movies/Translations/MovieTranslationService.cs b/src/NzbDrone.Core/Movies/Translations/MovieTranslationService.cs index af170566c..c50750835 100644 --- a/src/NzbDrone.Core/Movies/Translations/MovieTranslationService.cs +++ b/src/NzbDrone.Core/Movies/Translations/MovieTranslationService.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Movies.Translations { public interface IMovieTranslationService { - List GetAllTranslationsForMovie(int movieId); + List GetAllTranslationsForMovieMetadata(int movieMetadataId); List GetAllTranslationsForLanguage(Language language); List UpdateTranslations(List titles, MovieMetadata movie); } @@ -27,9 +27,9 @@ namespace NzbDrone.Core.Movies.Translations _logger = logger; } - public List GetAllTranslationsForMovie(int movieId) + public List GetAllTranslationsForMovieMetadata(int movieMetadataId) { - return _translationRepo.FindByMovieMetadataId(movieId).ToList(); + return _translationRepo.FindByMovieMetadataId(movieMetadataId).ToList(); } public List GetAllTranslationsForLanguage(Language language) @@ -42,12 +42,12 @@ namespace NzbDrone.Core.Movies.Translations _translationRepo.Delete(title); } - public List UpdateTranslations(List translations, MovieMetadata movie) + public List UpdateTranslations(List translations, MovieMetadata movieMetadata) { - int movieId = movie.Id; + int movieMetadataId = movieMetadata.Id; // First update the movie ids so we can correlate them later - translations.ForEach(t => t.MovieMetadataId = movieId); + translations.ForEach(t => t.MovieMetadataId = movieMetadataId); // Then throw out any we don't have languages for translations = translations.Where(t => t.Language != null).ToList(); @@ -56,7 +56,7 @@ namespace NzbDrone.Core.Movies.Translations translations = translations.DistinctBy(t => t.Language).ToList(); // Now find translations to delete, update and insert - var existingTranslations = _translationRepo.FindByMovieMetadataId(movieId); + var existingTranslations = _translationRepo.FindByMovieMetadataId(movieMetadataId); translations.ForEach(c => c.Id = existingTranslations.FirstOrDefault(t => t.Language == c.Language)?.Id ?? 0); diff --git a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs index 4d98e174e..ababf2787 100644 --- a/src/NzbDrone.Core/Organizer/FileNameBuilder.cs +++ b/src/NzbDrone.Core/Organizer/FileNameBuilder.cs @@ -288,7 +288,7 @@ namespace NzbDrone.Core.Organizer if (!movie.MovieMetadata.Value.Translations.Any()) { - titles = _movieTranslationService.GetAllTranslationsForMovie(movie.Id).Where(t => t.Language == language).ToList(); + titles = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId).Where(t => t.Language == language).ToList(); } return titles.FirstOrDefault()?.Title ?? movie.Title; diff --git a/src/Radarr.Api.V3/Calendar/CalendarController.cs b/src/Radarr.Api.V3/Calendar/CalendarController.cs index c15a01892..d1ac367fe 100644 --- a/src/Radarr.Api.V3/Calendar/CalendarController.cs +++ b/src/Radarr.Api.V3/Calendar/CalendarController.cs @@ -59,7 +59,7 @@ namespace Radarr.Api.V3.Calendar } var availDelay = _configService.AvailabilityDelay; - var translations = _movieTranslationService.GetAllTranslationsForMovie(movie.Id); + var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.Id); var translation = GetMovieTranslation(translations, movie.MovieMetadata); var resource = movie.ToResource(availDelay, translation, _qualityUpgradableSpecification); diff --git a/src/Radarr.Api.V3/Credits/CreditController.cs b/src/Radarr.Api.V3/Credits/CreditController.cs index e4641d6a5..5a26addf8 100644 --- a/src/Radarr.Api.V3/Credits/CreditController.cs +++ b/src/Radarr.Api.V3/Credits/CreditController.cs @@ -29,13 +29,13 @@ namespace Radarr.Api.V3.Credits { if (movieMetadataId.HasValue) { - return _creditService.GetAllCreditsForMovie(movieMetadataId.Value).ToResource(); + return _creditService.GetAllCreditsForMovieMetadata(movieMetadataId.Value).ToResource(); } if (movieId.HasValue) { var movie = _movieService.GetMovie(movieId.Value); - return _creditService.GetAllCreditsForMovie(movie.MovieMetadataId).ToResource(); + return _creditService.GetAllCreditsForMovieMetadata(movie.MovieMetadataId).ToResource(); } return _creditService.GetAllCredits().ToResource(); diff --git a/src/Radarr.Api.V3/Movies/AlternativeTitleController.cs b/src/Radarr.Api.V3/Movies/AlternativeTitleController.cs index 19f3faf93..22cc7bda0 100644 --- a/src/Radarr.Api.V3/Movies/AlternativeTitleController.cs +++ b/src/Radarr.Api.V3/Movies/AlternativeTitleController.cs @@ -30,13 +30,13 @@ namespace Radarr.Api.V3.Movies { if (movieMetadataId.HasValue) { - return _altTitleService.GetAllTitlesForMovie(movieMetadataId.Value).ToResource(); + return _altTitleService.GetAllTitlesForMovieMetadata(movieMetadataId.Value).ToResource(); } if (movieId.HasValue) { var movie = _movieService.GetMovie(movieId.Value); - return _altTitleService.GetAllTitlesForMovie(movie.MovieMetadataId).ToResource(); + return _altTitleService.GetAllTitlesForMovieMetadata(movie.MovieMetadataId).ToResource(); } return _altTitleService.GetAllTitles().ToResource(); diff --git a/src/Radarr.Api.V3/Movies/MovieController.cs b/src/Radarr.Api.V3/Movies/MovieController.cs index 98bb2bda7..43682f2eb 100644 --- a/src/Radarr.Api.V3/Movies/MovieController.cs +++ b/src/Radarr.Api.V3/Movies/MovieController.cs @@ -165,7 +165,7 @@ namespace Radarr.Api.V3.Movies var availDelay = _configService.AvailabilityDelay; - var translations = _movieTranslationService.GetAllTranslationsForMovie(movie.MovieMetadataId); + var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId); var translation = GetMovieTranslation(translations, movie.MovieMetadata, (Language)_configService.MovieInfoLanguage); var resource = movie.ToResource(availDelay, translation, _qualityUpgradableSpecification); @@ -236,7 +236,7 @@ namespace Radarr.Api.V3.Movies var updatedMovie = _moviesService.UpdateMovie(model); var availDelay = _configService.AvailabilityDelay; - var translations = _movieTranslationService.GetAllTranslationsForMovie(movie.Id); + var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(movie.MovieMetadataId); var translation = GetMovieTranslation(translations, movie.MovieMetadata, (Language)_configService.MovieInfoLanguage); BroadcastResourceChange(ModelAction.Updated, updatedMovie.ToResource(availDelay, translation, _qualityUpgradableSpecification)); @@ -267,7 +267,7 @@ namespace Radarr.Api.V3.Movies public void Handle(MovieImportedEvent message) { var availDelay = _configService.AvailabilityDelay; - var translations = _movieTranslationService.GetAllTranslationsForMovie(message.ImportedMovie.Movie.Id); + var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(message.ImportedMovie.Movie.MovieMetadataId); var translation = GetMovieTranslation(translations, message.ImportedMovie.Movie.MovieMetadata, (Language)_configService.MovieInfoLanguage); BroadcastResourceChange(ModelAction.Updated, message.ImportedMovie.Movie.ToResource(availDelay, translation, _qualityUpgradableSpecification)); } @@ -287,7 +287,7 @@ namespace Radarr.Api.V3.Movies public void Handle(MovieUpdatedEvent message) { var availDelay = _configService.AvailabilityDelay; - var translations = _movieTranslationService.GetAllTranslationsForMovie(message.Movie.Id); + var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(message.Movie.MovieMetadataId); var translation = GetMovieTranslation(translations, message.Movie.MovieMetadata, (Language)_configService.MovieInfoLanguage); BroadcastResourceChange(ModelAction.Updated, message.Movie.ToResource(availDelay, translation, _qualityUpgradableSpecification)); } @@ -296,7 +296,7 @@ namespace Radarr.Api.V3.Movies public void Handle(MovieEditedEvent message) { var availDelay = _configService.AvailabilityDelay; - var translations = _movieTranslationService.GetAllTranslationsForMovie(message.Movie.Id); + var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(message.Movie.MovieMetadataId); var translation = GetMovieTranslation(translations, message.Movie.MovieMetadata, (Language)_configService.MovieInfoLanguage); BroadcastResourceChange(ModelAction.Updated, message.Movie.ToResource(availDelay, translation, _qualityUpgradableSpecification)); } @@ -314,7 +314,7 @@ namespace Radarr.Api.V3.Movies public void Handle(MovieRenamedEvent message) { var availDelay = _configService.AvailabilityDelay; - var translations = _movieTranslationService.GetAllTranslationsForMovie(message.Movie.Id); + var translations = _movieTranslationService.GetAllTranslationsForMovieMetadata(message.Movie.MovieMetadataId); var translation = GetMovieTranslation(translations, message.Movie.MovieMetadata, (Language)_configService.MovieInfoLanguage); BroadcastResourceChange(ModelAction.Updated, message.Movie.ToResource(availDelay, translation, _qualityUpgradableSpecification)); }