mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-20 21:54:25 -04:00
Added RSS support for torrents
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user