mirror of
https://github.com/Sonarr/Sonarr.git
synced 2025-01-10 23:29:53 +02:00
ParseEpisodeInfo will now handle repeating Episode Naming Format (S01E01E02 or S01E01-02), It will not handle ranges (S01E01-06)
Changed port back to 8989.
This commit is contained in:
parent
499279e2ac
commit
fd3d94c9b0
@ -148,7 +148,7 @@
|
|||||||
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
|
<virtualDirectory path="/" physicalPath="%NZBDRONE_PATH%\NZBDrone.Web" />
|
||||||
</application>
|
</application>
|
||||||
<bindings>
|
<bindings>
|
||||||
<binding protocol="http" bindingInformation="*:8111:" />
|
<binding protocol="http" bindingInformation="*:8989:" />
|
||||||
</bindings>
|
</bindings>
|
||||||
</site>
|
</site>
|
||||||
<siteDefaults>
|
<siteDefaults>
|
||||||
|
@ -13,7 +13,6 @@ namespace NzbDrone.Core.Test
|
|||||||
public class ParserTest
|
public class ParserTest
|
||||||
{
|
{
|
||||||
[Test]
|
[Test]
|
||||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, 1)]
|
|
||||||
[Row("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", 1, 3)]
|
[Row("Two.and.a.Half.Me.103.720p.HDTV.X264-DIMENSION", 1, 3)]
|
||||||
[Row("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", 1, 13)]
|
[Row("Two.and.a.Half.Me.113.720p.HDTV.X264-DIMENSION", 1, 13)]
|
||||||
[Row("Two.and.a.Half.Me.1013.720p.HDTV.X264-DIMENSION", 10, 13)]
|
[Row("Two.and.a.Half.Me.1013.720p.HDTV.X264-DIMENSION", 10, 13)]
|
||||||
@ -35,6 +34,18 @@ public void episode_parse(string path, int season, int episode)
|
|||||||
Assert.AreEqual(episode, result[0].EpisodeNumber);
|
Assert.AreEqual(episode, result[0].EpisodeNumber);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Row("The.Office.US.S03E01E02.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, 1, 2)]
|
||||||
|
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, 1, 6)]
|
||||||
|
public void episode_parse_multi(string path, int season, int episodeOne, int episodeTwo)
|
||||||
|
{
|
||||||
|
var result = Parser.ParseEpisodeInfo(path);
|
||||||
|
Assert.Count(2, result);
|
||||||
|
Assert.AreEqual(season, result[0].SeasonNumber);
|
||||||
|
Assert.AreEqual(episodeOne, result[0].EpisodeNumber);
|
||||||
|
Assert.AreEqual(episodeTwo, result[1].EpisodeNumber);
|
||||||
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.BDRip)]
|
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", QualityTypes.BDRip)]
|
||||||
[Row("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.BDRip)]
|
[Row("WEEDS.S03E01-06.DUAL.BDRip.AC3.-HELLYWOOD", QualityTypes.BDRip)]
|
||||||
|
@ -18,7 +18,7 @@ internal static class Parser
|
|||||||
|
|
||||||
private static readonly Regex[] ReportTitleRegex = new[]
|
private static readonly Regex[] ReportTitleRegex = new[]
|
||||||
{
|
{
|
||||||
new Regex(@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?:\-|\.|[a-z])(?<episode>\d+)\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
new Regex(@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)((?:\-|\.|[a-z])(?<episode>\d+))+\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled),
|
||||||
new Regex(@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?<episode>\d{2})\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled) //Supports 103/113 naming
|
new Regex(@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?<episode>\d{2})\W(?!\\)", RegexOptions.IgnoreCase | RegexOptions.Compiled) //Supports 103/113 naming
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -58,18 +58,22 @@ internal static List<EpisodeParseResult> ParseEpisodeInfo(string title)
|
|||||||
foreach (Match matchGroup in match)
|
foreach (Match matchGroup in match)
|
||||||
{
|
{
|
||||||
|
|
||||||
var parsedEpisode = new EpisodeParseResult
|
var seasonNumber = Convert.ToInt32(matchGroup.Groups["season"].Value);
|
||||||
{
|
|
||||||
SeriesTitle = seriesName,
|
foreach (Capture episode in matchGroup.Groups["episode"].Captures)
|
||||||
SeasonNumber = Convert.ToInt32(matchGroup.Groups["season"].Value),
|
{
|
||||||
EpisodeNumber = Convert.ToInt32(matchGroup.Groups["episode"].Value),
|
var parsedEpisode = new EpisodeParseResult
|
||||||
Year = year
|
{
|
||||||
};
|
SeriesTitle = seriesName,
|
||||||
|
SeasonNumber = seasonNumber,
|
||||||
|
EpisodeNumber = Convert.ToInt32(episode.Value),
|
||||||
|
Year = year
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
result.Add(parsedEpisode);
|
result.Add(parsedEpisode);
|
||||||
|
Logger.Trace("Episode Parsed. {0}", parsedEpisode);
|
||||||
Logger.Trace("Episode Parsed. {0}", parsedEpisode);
|
}
|
||||||
}
|
}
|
||||||
break; //Break out of the for loop, we don't want to process every REGEX for each item otherwise we'll get duplicates
|
break; //Break out of the for loop, we don't want to process every REGEX for each item otherwise we'll get duplicates
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,6 @@
|
|||||||
<supportedRuntime version="v4.0" />
|
<supportedRuntime version="v4.0" />
|
||||||
</startup>
|
</startup>
|
||||||
<appSettings>
|
<appSettings>
|
||||||
<add key="port" value="8111" />
|
<add key="port" value="8989" />
|
||||||
</appSettings>
|
</appSettings>
|
||||||
</configuration>
|
</configuration>
|
Loading…
Reference in New Issue
Block a user