Added RSS support for torrents

This commit is contained in:
Keivan Beigi
2013-09-13 16:17:58 -07:00
parent 89d603d71c
commit 82b06bab7a
59 changed files with 577 additions and 268 deletions
+17 -13
View File
@@ -5,30 +5,34 @@ using NzbDrone.Core.Parser.Model;
namespace NzbDrone.Core.Indexers.Newznab
{
public class NewznabParser : BasicRssParser
public class NewznabParser : RssParserBase
{
private static readonly XNamespace NewznabNamespace = "http://www.newznab.com/DTD/2010/feeds/attributes/";
protected override string GetNzbInfoUrl(XElement item)
{
return item.Comments().Replace("#comments", "");
}
protected override ReportInfo PostProcessor(XElement item, ReportInfo currentResult)
protected override long GetSize(XElement item)
{
var attributes = item.Elements("attr").ToList();
var sizeElement = attributes.SingleOrDefault(e => e.Attribute("name").Value.Equals("size", StringComparison.CurrentCultureIgnoreCase));
if (sizeElement == null)
{
}
return Convert.ToInt64(sizeElement.Attribute("value").Value);
}
protected override ReleaseInfo PostProcessor(XElement item, ReleaseInfo currentResult)
{
if (currentResult != null)
{
var attributes = item.Elements(NewznabNamespace + "attr").ToList();
var sizeElement = attributes.SingleOrDefault(e => e.Attribute("name").Value.Equals("size", StringComparison.CurrentCultureIgnoreCase));
var attributes = item.Elements("attr").ToList();
var rageIdElement = attributes.SingleOrDefault(e => e.Attribute("name").Value.Equals("rageid", StringComparison.CurrentCultureIgnoreCase));
if (sizeElement == null)
{
throw new SizeParsingException("Unable to parse size from: {0} [{1}]", currentResult.Title, currentResult.Indexer);
}
currentResult.Size = Convert.ToInt64(sizeElement.Attribute("value").Value);
if (rageIdElement != null)
{
int tvRageId;