diff --git a/src/NzbDrone.Core.Test/MetadataSource/SkyHook/SkyHookProxyFixture.cs b/src/NzbDrone.Core.Test/MetadataSource/SkyHook/SkyHookProxyFixture.cs index 9f8ccbf94..3b7b59cdc 100644 --- a/src/NzbDrone.Core.Test/MetadataSource/SkyHook/SkyHookProxyFixture.cs +++ b/src/NzbDrone.Core.Test/MetadataSource/SkyHook/SkyHookProxyFixture.cs @@ -33,7 +33,7 @@ namespace NzbDrone.Core.Test.MetadataSource.SkyHook { movie.Should().NotBeNull(); movie.Title.Should().NotBeNullOrWhiteSpace(); - movie.CleanTitle.Should().Be(Parser.Parser.CleanSeriesTitle(movie.Title)); + movie.CleanTitle.Should().Be(Parser.Parser.CleanMovieTitle(movie.Title)); movie.SortTitle.Should().Be(MovieTitleNormalizer.Normalize(movie.Title, movie.TmdbId)); movie.Overview.Should().NotBeNullOrWhiteSpace(); movie.InCinemas.Should().HaveValue(); diff --git a/src/NzbDrone.Core.Test/ParserTests/NormalizeTitleFixture.cs b/src/NzbDrone.Core.Test/ParserTests/NormalizeTitleFixture.cs index 21d9afcac..69dde0889 100644 --- a/src/NzbDrone.Core.Test/ParserTests/NormalizeTitleFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/NormalizeTitleFixture.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Law_and_Order_SVU", "lawordersvu")] public void should_normalize_series_title(string parsedSeriesName, string seriesName) { - var result = parsedSeriesName.CleanSeriesTitle(); + var result = parsedSeriesName.CleanMovieTitle(); result.Should().Be(seriesName); } @@ -28,7 +28,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("Im a cyborg, but thats ok", "imcyborgbutthatsok")] public void should_remove_special_characters_and_casing(string dirty, string clean) { - var result = dirty.CleanSeriesTitle(); + var result = dirty.CleanMovieTitle(); result.Should().Be(clean); } @@ -52,7 +52,7 @@ namespace NzbDrone.Core.Test.ParserTests foreach (var s in dirtyFormat) { var dirty = string.Format(s, word); - dirty.CleanSeriesTitle().Should().Be("wordword"); + dirty.CleanMovieTitle().Should().Be("wordword"); } } @@ -69,7 +69,7 @@ namespace NzbDrone.Core.Test.ParserTests foreach (var s in dirtyFormat) { var dirty = string.Format(s, "a"); - dirty.CleanSeriesTitle().Should().Be("wordword"); + dirty.CleanMovieTitle().Should().Be("wordword"); } } @@ -86,7 +86,7 @@ namespace NzbDrone.Core.Test.ParserTests foreach (var s in dirtyFormat) { var dirty = string.Format(s, "a"); - dirty.CleanSeriesTitle().Should().Be("wordankleword"); + dirty.CleanMovieTitle().Should().Be("wordankleword"); } } @@ -103,7 +103,7 @@ namespace NzbDrone.Core.Test.ParserTests foreach (var s in dirtyFormat) { var dirty = string.Format(s, "a"); - dirty.CleanSeriesTitle().Should().Be("wordnkleaword"); + dirty.CleanMovieTitle().Should().Be("wordnkleaword"); } } @@ -128,7 +128,7 @@ namespace NzbDrone.Core.Test.ParserTests foreach (var s in dirtyFormat) { var dirty = string.Format(s, word); - dirty.CleanSeriesTitle().Should().Be("word" + word.ToLower() + "word"); + dirty.CleanMovieTitle().Should().Be("word" + word.ToLower() + "word"); } } @@ -137,7 +137,7 @@ namespace NzbDrone.Core.Test.ParserTests [TestCase("The.Daily.Show", "thedailyshow")] public void should_not_remove_from_the_beginning_of_the_title(string parsedSeriesName, string seriesName) { - var result = parsedSeriesName.CleanSeriesTitle(); + var result = parsedSeriesName.CleanMovieTitle(); result.Should().Be(seriesName); } @@ -159,14 +159,14 @@ namespace NzbDrone.Core.Test.ParserTests foreach (var s in dirtyFormat) { var dirty = string.Format(s, word); - dirty.CleanSeriesTitle().Should().Be(word + "wordword"); + dirty.CleanMovieTitle().Should().Be(word + "wordword"); } } [Test] public void should_not_clean_trailing_a() { - "Tokyo Ghoul A".CleanSeriesTitle().Should().Be("tokyoghoula"); + "Tokyo Ghoul A".CleanMovieTitle().Should().Be("tokyoghoula"); } } } diff --git a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs index 8c65924f2..3e0667a60 100644 --- a/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs +++ b/src/NzbDrone.Core.Test/ParserTests/ParserFixture.cs @@ -30,7 +30,7 @@ namespace NzbDrone.Core.Test.ParserTests { const string title = "Carniv\u00E0le"; - title.CleanSeriesTitle().Should().Be("carnivale"); + title.CleanMovieTitle().Should().Be("carnivale"); } [TestCase("The.Man.from.U.N.C.L.E.2015.1080p.BluRay.x264-SPARKS", "The Man from U.N.C.L.E.")] diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index 0c65abbc7..b6af965c7 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -164,7 +164,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook movie.Title = resource.Title; movie.OriginalTitle = resource.OriginalTitle; movie.TitleSlug = resource.TitleSlug; - movie.CleanTitle = resource.Title.CleanSeriesTitle(); + movie.CleanTitle = resource.Title.CleanMovieTitle(); movie.SortTitle = Parser.Parser.NormalizeTitle(resource.Title); movie.Overview = resource.Overview; @@ -459,7 +459,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook { Title = arg.Title, SourceType = SourceType.TMDB, - CleanTitle = arg.Title.CleanSeriesTitle(), + CleanTitle = arg.Title.CleanMovieTitle(), Language = IsoLanguages.Find(arg.Language.ToLower())?.Language ?? Language.English }; @@ -472,7 +472,7 @@ namespace NzbDrone.Core.MetadataSource.SkyHook { Title = arg.Title, Overview = arg.Overview, - CleanTitle = arg.Title.CleanSeriesTitle(), + CleanTitle = arg.Title.CleanMovieTitle(), Language = IsoLanguages.Find(arg.Language.ToLower())?.Language }; diff --git a/src/NzbDrone.Core/Movies/AddMovieService.cs b/src/NzbDrone.Core/Movies/AddMovieService.cs index f3a21adcf..1316245fe 100644 --- a/src/NzbDrone.Core/Movies/AddMovieService.cs +++ b/src/NzbDrone.Core/Movies/AddMovieService.cs @@ -100,7 +100,7 @@ namespace NzbDrone.Core.Movies newMovie.Path = Path.Combine(newMovie.RootFolderPath, folderName); } - newMovie.CleanTitle = newMovie.Title.CleanSeriesTitle(); + newMovie.CleanTitle = newMovie.Title.CleanMovieTitle(); newMovie.SortTitle = MovieTitleNormalizer.Normalize(newMovie.Title, newMovie.TmdbId); newMovie.Added = DateTime.UtcNow; diff --git a/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitle.cs b/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitle.cs index 6360ffe23..6645e265f 100644 --- a/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitle.cs +++ b/src/NzbDrone.Core/Movies/AlternativeTitles/AlternativeTitle.cs @@ -22,7 +22,7 @@ namespace NzbDrone.Core.Movies.AlternativeTitles public AlternativeTitle(string title, SourceType sourceType = SourceType.TMDB, int sourceId = 0, Language language = null) { Title = title; - CleanTitle = title.CleanSeriesTitle(); + CleanTitle = title.CleanMovieTitle(); SourceType = sourceType; SourceId = sourceId; Language = language ?? Language.English; diff --git a/src/NzbDrone.Core/Movies/MovieService.cs b/src/NzbDrone.Core/Movies/MovieService.cs index d83b8a5af..3dd21e090 100644 --- a/src/NzbDrone.Core/Movies/MovieService.cs +++ b/src/NzbDrone.Core/Movies/MovieService.cs @@ -103,12 +103,12 @@ namespace NzbDrone.Core.Movies public Movie FindByTitle(string title) { - return FindByTitle(title.CleanSeriesTitle(), null); + return FindByTitle(title.CleanMovieTitle(), null); } public Movie FindByTitle(string title, int year) { - return FindByTitle(title.CleanSeriesTitle(), year as int?); + return FindByTitle(title.CleanMovieTitle(), year as int?); } private Movie FindByTitle(string cleanTitle, int? year) @@ -166,7 +166,7 @@ namespace NzbDrone.Core.Movies private List FindByTitleInexactAll(string title) { // find any movie clean title within the provided release title - string cleanTitle = title.CleanSeriesTitle(); + string cleanTitle = title.CleanMovieTitle(); var list = _movieRepository.FindByTitleInexact(cleanTitle); if (!list.Any()) { @@ -180,7 +180,7 @@ namespace NzbDrone.Core.Movies { position = cleanTitle.IndexOf(movie.CleanTitle), length = movie.CleanTitle.Length, - movie = movie + movie }) .Where(s => (s.position >= 0)) .ToList() @@ -359,7 +359,7 @@ namespace NzbDrone.Core.Movies { if (movie.Year > 1850) { - result = FindByTitle(movie.Title.CleanSeriesTitle(), movie.Year); + result = FindByTitle(movie.Title.CleanMovieTitle(), movie.Year); if (result != null) { return true; @@ -367,7 +367,7 @@ namespace NzbDrone.Core.Movies } else { - result = FindByTitle(movie.Title.CleanSeriesTitle()); + result = FindByTitle(movie.Title.CleanMovieTitle()); if (result != null) { return true; @@ -389,7 +389,7 @@ namespace NzbDrone.Core.Movies var ret = withTmdbid.ExceptBy(m => m.TmdbId, allMovies, m => m.TmdbId, EqualityComparer.Default) .Union(withImdbid.ExceptBy(m => m.ImdbId, allMovies, m => m.ImdbId, EqualityComparer.Default)) - .Union(rest.ExceptBy(m => m.Title.CleanSeriesTitle(), allMovies, m => m.CleanTitle, EqualityComparer.Default)).ToList(); + .Union(rest.ExceptBy(m => m.Title.CleanMovieTitle(), allMovies, m => m.CleanTitle, EqualityComparer.Default)).ToList(); return ret; } diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index b88d55b79..6fb798809 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -374,7 +374,7 @@ namespace NzbDrone.Core.Parser return value; } - public static string CleanSeriesTitle(this string title) + public static string CleanMovieTitle(this string title) { long number = 0; diff --git a/src/NzbDrone.Core/Parser/ParsingService.cs b/src/NzbDrone.Core/Parser/ParsingService.cs index 5eeacd164..8d48a0db9 100644 --- a/src/NzbDrone.Core/Parser/ParsingService.cs +++ b/src/NzbDrone.Core/Parser/ParsingService.cs @@ -68,20 +68,13 @@ namespace NzbDrone.Core.Parser { if (helpers != null) { - minimalInfo = AugmentMovieInfo(minimalInfo, helpers); - } + var augmenters = _augmenters.Where(a => helpers.Any(t => a.HelperType.IsInstanceOfType(t)) || a.HelperType == null); - return minimalInfo; - } - - private ParsedMovieInfo AugmentMovieInfo(ParsedMovieInfo minimalInfo, List helpers) - { - var augmenters = _augmenters.Where(a => helpers.Any(t => a.HelperType.IsInstanceOfType(t)) || a.HelperType == null); - - foreach (var augmenter in augmenters) - { - minimalInfo = augmenter.AugmentMovieInfo(minimalInfo, - helpers.FirstOrDefault(h => augmenter.HelperType.IsInstanceOfType(h))); + foreach (var augmenter in augmenters) + { + minimalInfo = augmenter.AugmentMovieInfo(minimalInfo, + helpers.FirstOrDefault(h => augmenter.HelperType.IsInstanceOfType(h))); + } } return minimalInfo; @@ -255,11 +248,11 @@ namespace NzbDrone.Core.Parser possibleTitles.Add(altTitle.CleanTitle); } - string cleanTitle = parsedMovieInfo.MovieTitle.CleanSeriesTitle(); + string cleanTitle = parsedMovieInfo.MovieTitle.CleanMovieTitle(); foreach (string title in possibleTitles) { - if (title == parsedMovieInfo.MovieTitle.CleanSeriesTitle()) + if (title == parsedMovieInfo.MovieTitle.CleanMovieTitle()) { possibleMovie = searchCriteria.Movie; } @@ -270,12 +263,12 @@ namespace NzbDrone.Core.Parser string romanNumeral = numeralMapping.RomanNumeralLowerCase; //_logger.Debug(cleanTitle); - if (title.Replace(arabicNumeral, romanNumeral) == parsedMovieInfo.MovieTitle.CleanSeriesTitle()) + if (title.Replace(arabicNumeral, romanNumeral) == parsedMovieInfo.MovieTitle.CleanMovieTitle()) { possibleMovie = searchCriteria.Movie; } - if (title == parsedMovieInfo.MovieTitle.CleanSeriesTitle().Replace(arabicNumeral, romanNumeral)) + if (title == parsedMovieInfo.MovieTitle.CleanMovieTitle().Replace(arabicNumeral, romanNumeral)) { possibleMovie = searchCriteria.Movie; }