1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-03-05 15:15:59 +02:00
Sonarr/NzbDrone.Core/Indexers/Omgwtfnzbs/OmgwtfnzbsParser.cs

35 lines
1.2 KiB
C#
Raw Normal View History

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