diff --git a/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Aggregation/Aggregators/AggregateReleaseGroupFixture.cs b/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Aggregation/Aggregators/AggregateReleaseGroupFixture.cs index a7506e046..6ac79a438 100644 --- a/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Aggregation/Aggregators/AggregateReleaseGroupFixture.cs +++ b/src/NzbDrone.Core.Test/MediaFiles/MovieImport/Aggregation/Aggregators/AggregateReleaseGroupFixture.cs @@ -79,5 +79,45 @@ namespace NzbDrone.Core.Test.MediaFiles.MovieImport.Aggregation.Aggregators localMovie.ReleaseGroup.Should().Be("Wizzy"); } + + [Test] + public void should_not_use_imdbId() + { + var fileMovieInfo = Parser.Parser.ParseMovieTitle("Lock Stock and Two Smoking Barrels (1998) [imdb-tt0120735][Bluray-1080p][8bit][x264][DTS-HD MA 5.1]-FraMeSToR", false); + var folderMovieInfo = Parser.Parser.ParseMovieTitle("Lock Stock and Two Smoking Barrels (1998) {imdb-tt0120735}", false); + var downloadClientMovieInfo = Parser.Parser.ParseMovieTitle("Movie.Title.2008.WEB-DL", false); + var localMovie = new LocalMovie + { + FileMovieInfo = fileMovieInfo, + FolderMovieInfo = folderMovieInfo, + DownloadClientMovieInfo = downloadClientMovieInfo, + Path = @"C:\Test\Unsorted Movies\Movie.Title.2008\Movie.Title.2008.mkv".AsOsAgnostic(), + Movie = _movie + }; + + Subject.Aggregate(localMovie, null, false); + + localMovie.ReleaseGroup.Should().Be("FraMeSToR"); + } + + [Test] + public void should_not_use_tmdbbId() + { + var fileMovieInfo = Parser.Parser.ParseMovieTitle("Lock Stock and Two Smoking Barrels (1998) [tmdb-100][Bluray-1080p][8bit][x264][DTS-HD MA 5.1]-FraMeSToR", false); + var folderMovieInfo = Parser.Parser.ParseMovieTitle("Lock Stock and Two Smoking Barrels (1998) {tmdb-100}", false); + var downloadClientMovieInfo = Parser.Parser.ParseMovieTitle("Movie.Title.2008.WEB-DL", false); + var localMovie = new LocalMovie + { + FileMovieInfo = fileMovieInfo, + FolderMovieInfo = folderMovieInfo, + DownloadClientMovieInfo = downloadClientMovieInfo, + Path = @"C:\Test\Unsorted Movies\Movie.Title.2008\Movie.Title.2008.mkv".AsOsAgnostic(), + Movie = _movie + }; + + Subject.Aggregate(localMovie, null, false); + + localMovie.ReleaseGroup.Should().Be("FraMeSToR"); + } } } diff --git a/src/NzbDrone.Core/Parser/Parser.cs b/src/NzbDrone.Core/Parser/Parser.cs index d506e20f3..49999a72c 100644 --- a/src/NzbDrone.Core/Parser/Parser.cs +++ b/src/NzbDrone.Core/Parser/Parser.cs @@ -116,7 +116,7 @@ namespace NzbDrone.Core.Parser private static readonly Regex CleanQualityBracketsRegex = new Regex(@"\[[a-z0-9 ._-]+\]$", RegexOptions.IgnoreCase | RegexOptions.Compiled); - private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?[a-z0-9]+(?-[a-z0-9]+)?(?!.+?(?:480p|720p|1080p|2160p)))(?)?)(?:\b|[-._ ]|$)|[-._ ]\[(?[a-z0-9]+)\]$", + private static readonly Regex ReleaseGroupRegex = new Regex(@"-(?[a-z0-9]+(?-[a-z0-9]+)?(?!.+?(?:480p|720p|1080p|2160p)))(?\d+)|(?tt\d{7,8}))(?:\k)?)(?:\b|[-._ ]|$)|[-._ ]\[(?[a-z0-9]+)\]$", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly Regex AnimeReleaseGroupRegex = new Regex(@"^(?:\[(?(?!\s).+?(?