Fixed: Improve parsing of some episodes using day-month-year format

pull/7657/head
Bogdan 6 days ago committed by GitHub
parent a2670a5804
commit 5d16169e52
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -35,8 +35,7 @@ namespace NzbDrone.Core.Test.ParserTests
[TestCase("Series Title (1955) - 1954-01-23 05 00 00 - Cottage for Sale.ts", "Series Title (1955)", 1954, 1, 23)] [TestCase("Series Title (1955) - 1954-01-23 05 00 00 - Cottage for Sale.ts", "Series Title (1955)", 1954, 1, 23)]
[TestCase("Series Title - 30-04-2024 HDTV 1080p H264 AAC", "Series Title", 2024, 4, 30)] [TestCase("Series Title - 30-04-2024 HDTV 1080p H264 AAC", "Series Title", 2024, 4, 30)]
[TestCase("Series On TitleClub E76 2024 08 08 1080p WEB H264-RnB96 [TJET]", "Series On TitleClub", 2024, 8, 8)] [TestCase("Series On TitleClub E76 2024 08 08 1080p WEB H264-RnB96 [TJET]", "Series On TitleClub", 2024, 8, 8)]
[TestCase("Series.Title.13.02.2025.1080i.HDTV.MPA2.0.H.264", "Series Title", 2025, 2, 13)]
// [TestCase("", "", 0, 0, 0)]
public void should_parse_daily_episode(string postTitle, string title, int year, int month, int day) public void should_parse_daily_episode(string postTitle, string title, int year, int month, int day)
{ {
var result = Parser.Parser.ParseTitle(postTitle); var result = Parser.Parser.ParseTitle(postTitle);
@ -104,8 +103,7 @@ namespace NzbDrone.Core.Test.ParserTests
} }
[TestCase("Tmc - Quotidien - 05-06-2024 HDTV 1080p H264 AAC")] [TestCase("Tmc - Quotidien - 05-06-2024 HDTV 1080p H264 AAC")]
[TestCase("Series.Title.12.02.2025.1080i.HDTV.MPA2.0.H.264")]
// [TestCase("", "", 0, 0, 0)]
public void should_not_parse_ambiguous_daily_episode(string postTitle) public void should_not_parse_ambiguous_daily_episode(string postTitle)
{ {
Parser.Parser.ParseTitle(postTitle).Should().BeNull(); Parser.Parser.ParseTitle(postTitle).Should().BeNull();

@ -1191,14 +1191,12 @@ namespace NzbDrone.Core.Parser
{ {
airmonth = Convert.ToInt32(matchCollection[0].Groups["airmonth"].Value); airmonth = Convert.ToInt32(matchCollection[0].Groups["airmonth"].Value);
airday = Convert.ToInt32(matchCollection[0].Groups["airday"].Value); airday = Convert.ToInt32(matchCollection[0].Groups["airday"].Value);
}
// Swap day and month if month is bigger than 12 (scene fail) // Swap day and month if month is bigger than 12 (scene fail)
if (airmonth > 12) if (airmonth > 12)
{ {
var tempDay = airday; (airday, airmonth) = (airmonth, airday);
airday = airmonth;
airmonth = tempDay;
}
} }
DateTime airDate; DateTime airDate;

Loading…
Cancel
Save