Fixed: Parsing [book] by [author]

This commit is contained in:
ta264
2021-02-12 19:47:15 +00:00
parent 1cdcfe25c0
commit 32833b5fc4
2 changed files with 11 additions and 0 deletions

View File

@@ -159,6 +159,13 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Brother Ali-2007-The Undisputed Truth-FTD", "Brother Ali", "The Undisputed Truth")] [TestCase("Brother Ali-2007-The Undisputed Truth-FTD", "Brother Ali", "The Undisputed Truth")]
[TestCase("Brother Ali-The Undisputed Truth-2007-FTD", "Brother Ali", "The Undisputed Truth")] [TestCase("Brother Ali-The Undisputed Truth-2007-FTD", "Brother Ali", "The Undisputed Truth")]
// MAM
[TestCase("City of Bones by Cassandra Clare [ENG / epub]", "Cassandra Clare", "City of Bones")]
[TestCase("The Ivory Tower and Harry Potter - Perspectives on a Literary Phenomenon by Lana E Whited [ENG / pdf]", "Lana E Whited", "The Ivory Tower and Harry Potter - Perspectives on a Literary Phenomenon")]
[TestCase("America by design by David Noble [eng]", "David Noble", "America by design")]
[TestCase("The Great Gatsby by F. Scott Fitzgerald [azw3]", "F Scott Fitzgerald", "The Great Gatsby")]
[TestCase("Megabytes by Computer [pdf]", "Computer", "Megabytes")]
// ruTracker // ruTracker
[TestCase("(Eclectic Progressive Rock) [CD] Peter Hammill - From The Trees - 2017, FLAC (tracks + .cue), lossless", "Peter Hammill", "From The Trees")] [TestCase("(Eclectic Progressive Rock) [CD] Peter Hammill - From The Trees - 2017, FLAC (tracks + .cue), lossless", "Peter Hammill", "From The Trees")]
[TestCase("(Folk Rock / Pop) Aztec Two-Step - Naked - 2017, MP3, 320 kbps", "Aztec Two-Step", "Naked")] [TestCase("(Folk Rock / Pop) Aztec Two-Step - Naked - 2017, MP3, 320 kbps", "Aztec Two-Step", "Naked")]

View File

@@ -64,6 +64,10 @@ namespace NzbDrone.Core.Parser
new Regex(@"^(?<author>.+?)\W*(?<discography>Discography|Discografia)", new Regex(@"^(?<author>.+?)\W*(?<discography>Discography|Discografia)",
RegexOptions.IgnoreCase | RegexOptions.Compiled), RegexOptions.IgnoreCase | RegexOptions.Compiled),
//MyAnonaMouse - Title by Author [lang / pdf]
new Regex(@"^(?<book>.+)\bby\b(?<author>.+?)(?:\[|\()",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
//ruTracker - (Genre) [Source]? Author - Book - Year //ruTracker - (Genre) [Source]? Author - Book - Year
new Regex(@"^(?:\(.+?\))(?:\W*(?:\[(?<source>.+?)\]))?\W*(?<author>.+?)(?: - )(?<book>.+?)(?: - )(?<releaseyear>\d{4})", new Regex(@"^(?:\(.+?\))(?:\W*(?:\[(?<source>.+?)\]))?\W*(?<author>.+?)(?: - )(?<book>.+?)(?: - )(?<releaseyear>\d{4})",
RegexOptions.IgnoreCase | RegexOptions.Compiled), RegexOptions.IgnoreCase | RegexOptions.Compiled),