1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-27 02:09:59 +00:00

Fixed: #4394 parsing multi language from ReleaseGroup name

This commit is contained in:
Gabriel Patzleiner 2020-06-07 20:59:37 +02:00 committed by Qstick
parent 40b630ef10
commit 57961df1df
2 changed files with 29 additions and 11 deletions

View file

@ -174,6 +174,23 @@ public void should_not_parse_wrong_language_in_title(string postTitle)
parsed.Languages.First().Should().Be(Language.English); parsed.Languages.First().Should().Be(Language.English);
} }
[TestCase("The.Purge.3.Election.Year.2016.German.DTS.DL.720p.BluRay.x264-MULTiPLEX")]
public void should_not_parse_multi_language_in_releasegroup(string postTitle)
{
var parsed = Parser.Parser.ParseMovieTitle(postTitle, true);
parsed.Languages.Count().Should().Be(1);
parsed.Languages.First().Should().Be(Language.German);
}
[TestCase("The.Purge.3.Election.Year.2016.German.Multi.DTS.DL.720p.BluRay.x264-MULTiPLEX")]
public void should_parse_multi_language(string postTitle)
{
var parsed = Parser.Parser.ParseMovieTitle(postTitle, true);
parsed.Languages.Count().Should().Be(2);
parsed.Languages.Should().Contain(Language.German);
parsed.Languages.Should().Contain(Language.English, "Added by the multi tag in the release name");
}
[TestCase("The Italian Job 2008 [tt1234567] 720p BluRay X264", "tt1234567")] [TestCase("The Italian Job 2008 [tt1234567] 720p BluRay X264", "tt1234567")]
[TestCase("The Italian Job 2008 [tt12345678] 720p BluRay X264", "tt12345678")] [TestCase("The Italian Job 2008 [tt12345678] 720p BluRay X264", "tt12345678")]
public void should_parse_imdb_in_title(string postTitle, string imdb) public void should_parse_imdb_in_title(string postTitle, string imdb)

View file

@ -240,17 +240,6 @@ public static ParsedMovieInfo ParseMovieTitle(string title, bool isDir = false)
simpleReleaseTitle = simpleReleaseTitle.Replace(simpleTitleReplaceString, simpleTitleReplaceString.Contains(".") ? "A.Movie" : "A Movie"); simpleReleaseTitle = simpleReleaseTitle.Replace(simpleTitleReplaceString, simpleTitleReplaceString.Contains(".") ? "A.Movie" : "A Movie");
} }
result.Languages = LanguageParser.ParseLanguages(simpleReleaseTitle);
Logger.Debug("Languages parsed: {0}", string.Join(", ", result.Languages));
result.Quality = QualityParser.ParseQuality(title);
Logger.Debug("Quality parsed: {0}", result.Quality);
if (result.Edition.IsNullOrWhiteSpace())
{
result.Edition = ParseEdition(simpleReleaseTitle);
}
result.ReleaseGroup = ParseReleaseGroup(simpleReleaseTitle); result.ReleaseGroup = ParseReleaseGroup(simpleReleaseTitle);
var subGroup = GetSubGroup(match); var subGroup = GetSubGroup(match);
@ -261,6 +250,18 @@ public static ParsedMovieInfo ParseMovieTitle(string title, bool isDir = false)
Logger.Debug("Release Group parsed: {0}", result.ReleaseGroup); Logger.Debug("Release Group parsed: {0}", result.ReleaseGroup);
result.Languages = LanguageParser.ParseLanguages(result.ReleaseGroup.IsNotNullOrWhiteSpace() ? simpleReleaseTitle.Replace(result.ReleaseGroup, "RlsGrp") : simpleReleaseTitle);
Logger.Debug("Languages parsed: {0}", string.Join(", ", result.Languages));
result.Quality = QualityParser.ParseQuality(title);
Logger.Debug("Quality parsed: {0}", result.Quality);
if (result.Edition.IsNullOrWhiteSpace())
{
result.Edition = ParseEdition(simpleReleaseTitle);
Logger.Debug("Edition parsed: {0}", result.Edition);
}
result.ReleaseHash = GetReleaseHash(match); result.ReleaseHash = GetReleaseHash(match);
if (!result.ReleaseHash.IsNullOrWhiteSpace()) if (!result.ReleaseHash.IsNullOrWhiteSpace())
{ {