FF-1876: Fixed TV Episode lookup with space between season and episode number

This commit is contained in:
John Andrews
2024-10-19 09:58:30 +13:00
parent 14baf55bad
commit 61efb1093d
2 changed files with 18 additions and 1 deletions
@@ -32,6 +32,23 @@ public class TVEpisodeLookupTests : TestBase
Assert.IsFalse(string.IsNullOrWhiteSpace(args.Variables["tvepisode.Overview"] as string));
}
[TestMethod]
public void TheBatman_s02space01()
{
var args = GetNodeParameters("The Batman/Season 2/The Batman s02 e01.mkv");
var element = new TVEpisodeLookup();
var result = element.Execute(args);
Assert.AreEqual(1, result);
Assert.AreEqual("The Batman", args.Variables["tvepisode.Title"]);
Assert.AreEqual(2, args.Variables["tvepisode.Season"]);
Assert.AreEqual(1, args.Variables["tvepisode.Episode"]);
Assert.AreEqual("The Cat, the Bat and the Very Ugly", args.Variables["tvepisode.Subtitle"]);
Assert.IsFalse(string.IsNullOrWhiteSpace(args.Variables["tvepisode.Overview"] as string));
}
[TestMethod]
public void TheBatman_2x03()
{
+1 -1
View File
@@ -196,7 +196,7 @@ public class TVShowLookup : Node
// Replace "1x02" format with "s1e02"
text = Regex.Replace(text, @"(?<season>\d+)x(?<episode>\d+)", "s${season}e${episode}", RegexOptions.IgnoreCase);
// Replace "s01.02" or "s01.e02" with "s01e02"
text = Regex.Replace(text, @"(?<season>s\d+)\.(e)?(?<episode>\d+)", "${season}e${episode}", RegexOptions.IgnoreCase);
text = Regex.Replace(text, @"(?<season>s\d+)[\.\s]?(e)?(?<episode>\d+)", "${season}e${episode}", RegexOptions.IgnoreCase);
// this removes any {tvdb-123456} etc
string variableMatch = @"\{[a-zA-Z]+-[0-9]+\}";