mirror of
https://github.com/Radarr/Radarr
synced 2025-03-03 18:36:41 +00:00
Fixed header parsing
This commit is contained in:
parent
c91ff9be3e
commit
fae0cadbec
4 changed files with 23 additions and 7 deletions
|
@ -453,5 +453,12 @@ public void parse_releaseGroup(string title, string expected)
|
||||||
{
|
{
|
||||||
Parser.ParseReleaseGroup(title).Should().Be(expected);
|
Parser.ParseReleaseGroup(title).Should().Be(expected);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[TestCase("[112461]-[FULL]-[#a.b.teevee@EFNet]-[ 666.Park.Avenue.S01E03.720p.HDTV.X264-DIMENSION ]-[02/31] - \"the.devils.address.103.720p-dimension.par2\" yEnc", "666.Park.Avenue.S01E03.720p.HDTV.X264-DIMENSION")]
|
||||||
|
[TestCase("[112438]-[FULL]-[#a.b.teevee@EFNet]-[ Downton_Abbey.3x05.HDTV_x264-FoV ]-[01/26] - \"downton_abbey.3x05.hdtv_x264-fov.nfo\" yEnc", "Downton_Abbey.3x05.HDTV_x264-FoV")]
|
||||||
|
public void parse_header(string title, string expected)
|
||||||
|
{
|
||||||
|
Parser.ParseHeader(title).Should().Be(expected);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,8 +74,14 @@ public static class Parser
|
||||||
private static readonly Regex ReportSizeRegex = new Regex(@"(?<value>\d+\.\d{1,2}|\d+\,\d+\.\d{1,2})\W?(?<unit>GB|MB|GiB|MiB)",
|
private static readonly Regex ReportSizeRegex = new Regex(@"(?<value>\d+\.\d{1,2}|\d+\,\d+\.\d{1,2})\W?(?<unit>GB|MB|GiB|MiB)",
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||||
|
|
||||||
private static readonly Regex HeaderRegex = new Regex(@"(?:\[.+\]\-\[.+\]\-\[.+\]\-\[)(?<nzbTitle>.+)(?:\]\-.+)",
|
private static readonly Regex[] HeaderRegex = new[]
|
||||||
RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
{
|
||||||
|
new Regex(@"(?:\[.+\]\-\[.+\]\-\[.+\]\-\[)(?<nzbTitle>.+)(?:\]\-.+)",
|
||||||
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
|
||||||
|
new Regex(@"(?:\[)(?<nzbTitle>.+)(?:\]\-.+)",
|
||||||
|
RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
|
};
|
||||||
|
|
||||||
internal static EpisodeParseResult ParsePath(string path)
|
internal static EpisodeParseResult ParsePath(string path)
|
||||||
{
|
{
|
||||||
|
@ -480,10 +486,13 @@ public static long GetReportSize(string sizeString)
|
||||||
|
|
||||||
internal static string ParseHeader(string header)
|
internal static string ParseHeader(string header)
|
||||||
{
|
{
|
||||||
var match = HeaderRegex.Matches(header);
|
foreach(var regex in HeaderRegex)
|
||||||
|
{
|
||||||
|
var match = regex.Matches(header);
|
||||||
|
|
||||||
if (match.Count != 0)
|
if (match.Count != 0)
|
||||||
return match[0].Groups["nzbTitle"].Value;
|
return match[0].Groups["nzbTitle"].Value.Trim();
|
||||||
|
}
|
||||||
|
|
||||||
return header;
|
return header;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ protected override string[] Urls
|
||||||
return new[]
|
return new[]
|
||||||
{
|
{
|
||||||
String.Format("http://www.nzbclub.com/nzbfeed.aspx?ig=2&gid=102952&st=1&ns=1&q=%23a.b.teevee%40EFNet"),
|
String.Format("http://www.nzbclub.com/nzbfeed.aspx?ig=2&gid=102952&st=1&ns=1&q=%23a.b.teevee%40EFNet"),
|
||||||
String.Format("http://www.nzbclub.com/nzbfeed.aspx?ig=2&gid=5542&st=1&ns=1&q=%23a.b.teevee%40EFNet")
|
String.Format("http://www.nzbclub.com/nzbfeed.aspx?ig=2&gid=5542&st=1&ns=1&q=")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,7 +24,7 @@ protected override string[] Urls
|
||||||
return new[]
|
return new[]
|
||||||
{
|
{
|
||||||
String.Format("http://www.nzbindex.nl/rss/alt.binaries.teevee/?sort=agedesc&minsize=100&complete=1&max=50&more=1&q=%23a.b.teevee%40EFNet"),
|
String.Format("http://www.nzbindex.nl/rss/alt.binaries.teevee/?sort=agedesc&minsize=100&complete=1&max=50&more=1&q=%23a.b.teevee%40EFNet"),
|
||||||
String.Format("http://www.nzbindex.nl/rss/alt.binaries.hdtv/?sort=agedesc&minsize=100&complete=1&max=50&more=1&q=%23a.b.teevee%40EFNet")
|
String.Format("http://www.nzbindex.nl/rss/alt.binaries.hdtv/?sort=agedesc&minsize=100&complete=1&max=50&more=1&q=")
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue