Lidarr/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs

35 lines
1.2 KiB
C#
Raw Normal View History

2013-04-07 07:30:37 +00:00
using System;
using System.Text.RegularExpressions;
2013-08-06 02:45:57 +00:00
using System.Xml.Linq;
using NzbDrone.Core.Parser.Model;
2013-04-07 07:30:37 +00:00
namespace NzbDrone.Core.Indexers.Omgwtfnzbs
{
public class OmgwtfnzbsParser : BasicRssParser
{
2013-08-06 02:45:57 +00:00
protected override string GetNzbInfoUrl(XElement item)
2013-04-07 07:30:37 +00:00
{
//Todo: Me thinks I need to parse details to get this...
2013-08-06 02:45:57 +00:00
var match = Regex.Match(item.Description(), @"(?:\<b\>View NZB\:\<\/b\>\s\<a\shref\=\"")(?<URL>.+)(?:\""\starget)",
2013-04-07 07:30:37 +00:00
RegexOptions.IgnoreCase | RegexOptions.Compiled);
if (match.Success)
{
return match.Groups["URL"].Value;
}
return String.Empty;
}
2013-08-06 02:45:57 +00:00
protected override ReportInfo PostProcessor(XElement item, ReportInfo currentResult)
2013-04-07 07:30:37 +00:00
{
if (currentResult != null)
{
2013-08-06 02:45:57 +00:00
var sizeString = Regex.Match(item.Description(), @"(?:Size:\<\/b\>\s\d+\.)\d{1,2}\s\w{2}(?:\<br \/\>)", RegexOptions.IgnoreCase | RegexOptions.Compiled).Value;
2013-04-07 22:40:13 +00:00
currentResult.Size = GetReportSize(sizeString);
2013-04-07 07:30:37 +00:00
}
return currentResult;
}
}
}