More quality parsing tests.

Better series/episode info parsing.
NzbMatrix and NzbsRUs Indexer Providers.
pull/3113/head
Mark McDowall 14 years ago
parent 6f2dcbf838
commit 0241e80c8a

@ -10,6 +10,7 @@ namespace NzbDrone.Core.Test
/*Fucked-up hall of shame,
* WWE.Wrestlemania.27.PPV.HDTV.XviD-KYR
* The.Kennedys.Part.2.DSR.XviD-SYS
*
*/
@ -30,7 +31,7 @@ namespace NzbDrone.Core.Test
[Row(@"The Event S01E14 A Message Back 720p WEB DL DD5 1 H264 SURFER", 1, 14)]
[Row(@"Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", 1, 7)]
[Row(@"Adam Hills In Gordon St Tonight S01E07 WS PDTV XviD FUtV", 1, 7)]
[Row("The.Kennedys.Part.2.DSR.XviD-SYS", 1, 2)]
//[Row("The.Kennedys.Part.2.DSR.XviD-SYS", 1, 2)]
public void episode_parse(string path, int season, int episode)
{
var result = Parser.ParseEpisodeInfo(path);
@ -65,9 +66,13 @@ namespace NzbDrone.Core.Test
}
[Test]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, new[] { 2, 3, 4, 5, 6 })]
//[Row("Two.and.a.Half.Men.103.104.720p.HDTV.X264-DIMENSION", 1, new[] {3, 4})]
//[Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, new[] {1, 2})]
[Row("WEEDS.S03E01-06.DUAL.BDRip.XviD.AC3.-HELLYWOOD", 3, new[] { 1, 2, 3, 4, 5, 6 })]
[Row("Two.and.a.Half.Men.103.104.720p.HDTV.X264-DIMENSION", 1, new[] {3, 4})]
[Row("Weeds.S03E01.S03E02.720p.HDTV.X264-DIMENSION", 3, new[] {1, 2})]
[Row("The Borgias S01e01 e02 ShoHD On Demand 1080i DD5 1 ALANiS", 1, new[] { 1, 2 })]
[Row("Big Time Rush 1x01 to 10 480i DD2 0 Sianto", 1, new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 })]
[Row("White.Collar.2x04.2x05.720p.BluRay-FUTV", 2, new[] { 4, 5 })]
//[Row("The.Kennedys.Part.1.and.Part.2.DSR.XviD-SYS", 1, new[] { 1, 2 })]
public void episode_multipart_parse(string path, int season, int[] episodes)
{
var result = Parser.ParseEpisodeInfo(path);

@ -169,6 +169,8 @@
<Compile Include="Instrumentation\SubsonicTarget.cs" />
<Compile Include="Instrumentation\ExceptioneerTarget.cs" />
<Compile Include="Instrumentation\NlogWriter.cs" />
<Compile Include="Providers\Indexer\NzbMatrixFeedProvider.cs" />
<Compile Include="Providers\Indexer\NzbsRUsFeedProvider.cs" />
<Compile Include="Repository\IndexerSetting.cs" />
<Compile Include="Model\EpisodeParseResult.cs" />
<Compile Include="Model\EpisodeRenameModel.cs" />

@ -15,10 +15,10 @@ namespace NzbDrone.Core
private static readonly Regex[] ReportTitleRegex = new[]
{
new Regex(
@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?:\-|\.|[a-z])(?<episode>\d+)\W(?!\\)",
@"(?<title>.+?)?\W?(?<year>\d{4}?)?(?:\WS?(?<season>\d{1,2})(?:(?:\-|\.|[ex]|\s|to)+(?<episode>\d+))+)+\W?(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled),
new Regex(
@"(?<title>.+?)?\W?(?<year>\d+?)?\WS?(?<season>\d+)(?<episode>\d{2})\W(?!\\)",
@"(?<title>.+?)?\W?(?<year>\d{4}?)?(?:\W(?<season>\d+)(?<episode>\d{2}))+\W?(?!\\)",
RegexOptions.IgnoreCase | RegexOptions.Compiled)
//Supports 103/113 naming
};
@ -45,7 +45,9 @@ namespace NzbDrone.Core
foreach (var regex in ReportTitleRegex)
{
var match = regex.Matches(title);
var simpleTitle = Regex.Replace(title, @"480[i|p]|720[i|p]|1080[i|p]|[x|h]264", String.Empty, RegexOptions.IgnoreCase | RegexOptions.Compiled);
var match = regex.Matches(simpleTitle);
if (match.Count != 0)
{
@ -69,7 +71,22 @@ namespace NzbDrone.Core
foreach (Match matchGroup in match)
{
parsedEpisode.Episodes.Add(Convert.ToInt32(matchGroup.Groups["episode"].Value));
var count = matchGroup.Groups["episode"].Captures.Count;
var first = Convert.ToInt32(matchGroup.Groups["episode"].Captures[0].Value);
var last = Convert.ToInt32(matchGroup.Groups["episode"].Captures[count - 1].Value);
for (int i = first; i <= last; i++)
{
parsedEpisode.Episodes.Add(i);
}
//else
//{
// foreach (Capture ep in matchGroup.Groups["episode"].Captures)
// {
// parsedEpisode.Episodes.Add(Convert.ToInt32(ep.Value));
// }
//}
}
parsedEpisode.Quality = ParseQuality(title);

@ -0,0 +1,39 @@
using System.ServiceModel.Syndication;
using NzbDrone.Core.Providers.Core;
using SubSonic.Repository;
namespace NzbDrone.Core.Providers.Indexer
{
internal class NzbMatrixFeedProvider : IndexerProviderBase
{
public NzbMatrixFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IRepository repository, IndexerProvider indexerProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, repository, indexerProvider)
{
}
protected override string[] Url
{
get
{
return new[]
{
string.Format(
"http://rss.nzbmatrix.com/rss.php?page=download&username={0}&apikey={1}&subcat=6,41&english=1&scenename=1",
_configProvider.NzbMatrixUsername,
_configProvider.NzbMatrixApiKey)
};
}
}
public override string Name
{
get { return "NzbMatrix"; }
}
protected override string NzbDownloadUrl(SyndicationItem item)
{
return item.Links[0].ToString();
}
}
}

@ -17,7 +17,7 @@ namespace NzbDrone.Core.Providers.Indexer
{
return new[]
{
string.Format("http://nzbs.org/rss.php?type=1&i={0}&h={1}", _configProvider.NzbsOrgUId, _configProvider.NzbsOrgHash)
string.Format("http://nzbs.org/rss.php?type=1&i={0}&h={1}&num=50&dl=1", _configProvider.NzbsOrgUId, _configProvider.NzbsOrgHash)
};
}
}
@ -30,7 +30,7 @@ namespace NzbDrone.Core.Providers.Indexer
protected override string NzbDownloadUrl(SyndicationItem item)
{
return item.Id.Replace("action=view", "action=getnzb");
return item.Id;
}

@ -0,0 +1,39 @@
using System.ServiceModel.Syndication;
using NzbDrone.Core.Providers.Core;
using SubSonic.Repository;
namespace NzbDrone.Core.Providers.Indexer
{
internal class NzbsRUsFeedProvider : IndexerProviderBase
{
public NzbsRUsFeedProvider(SeriesProvider seriesProvider, SeasonProvider seasonProvider, EpisodeProvider episodeProvider, ConfigProvider configProvider, HttpProvider httpProvider, IRepository repository, IndexerProvider indexerProvider)
: base(seriesProvider, seasonProvider, episodeProvider, configProvider, httpProvider, repository, indexerProvider)
{
}
protected override string[] Url
{
get
{
return new[]
{
string.Format(
"http://www.nzbsrus.com/rssfeed.php?cat=91,75&i={0}&h={1}",
_configProvider.NzbsrusUId,
_configProvider.NzbsrusHash)
};
}
}
public override string Name
{
get { return "NzbsRUs"; }
}
protected override string NzbDownloadUrl(SyndicationItem item)
{
return item.Links[0].ToString();
}
}
}
Loading…
Cancel
Save