mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-26 22:46:37 -04:00
New: Add generic TorrentRssIndexer support.
Add support for generic RSS feeds. Parses the feed and tests if it is EZTV compatible, or if it has all required fields for the generic TorrentRssParser
This commit is contained in:
committed by
Taloth Saldono
parent
bbcabf0632
commit
9d7522cc15
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Xml.Linq;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Parser.Model;
|
||||
|
||||
namespace NzbDrone.Core.Indexers
|
||||
@@ -10,6 +11,9 @@ namespace NzbDrone.Core.Indexers
|
||||
// Parse various seeder/leecher/peers formats in the description element to determine number of seeders.
|
||||
public Boolean ParseSeedersInDescription { get; set; }
|
||||
|
||||
// Use the specified element name to determine the size
|
||||
public String SizeElementName { get; set; }
|
||||
|
||||
public TorrentRssParser()
|
||||
{
|
||||
|
||||
@@ -88,6 +92,20 @@ namespace NzbDrone.Core.Indexers
|
||||
return null;
|
||||
}
|
||||
|
||||
protected override long GetSize(XElement item)
|
||||
{
|
||||
var size = base.GetSize(item);
|
||||
if (size == 0 && SizeElementName.IsNotNullOrWhiteSpace())
|
||||
{
|
||||
if (item.Element(SizeElementName) != null)
|
||||
{
|
||||
size = ParseSize(item.Element(SizeElementName).Value, true);
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
private static readonly Regex ParseSeedersRegex = new Regex(@"(Seeder)s?:\s+(?<value>\d+)|(?<value>\d+)\s+(seeder)s?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
private static readonly Regex ParseLeechersRegex = new Regex(@"(Leecher)s?:\s+(?<value>\d+)|(?<value>\d+)\s+(leecher)s?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
private static readonly Regex ParsePeersRegex = new Regex(@"(Peer)s?:\s+(?<value>\d+)|(?<value>\d+)\s+(peer)s?", RegexOptions.IgnoreCase | RegexOptions.Compiled);
|
||||
|
||||
Reference in New Issue
Block a user