parent
37e4a06b5d
commit
c7470a426a
@ -0,0 +1,86 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
|
||||
targetNamespace="http://torznab.com/schemas/2015/feed"
|
||||
xmlns:torznab="http://torznab.com/schemas/2015/feed">
|
||||
<xs:simpleType name="attrNames">
|
||||
<xs:restriction base="xs:string">
|
||||
<!-- https://github.com/nZEDb/nZEDb/blob/master/docs/newznab_api_specification.txt -->
|
||||
<!-- http://newznab.readthedocs.org/en/latest/misc/api/ -->
|
||||
<!-- Original newznab attributes -->
|
||||
<!-- All -->
|
||||
<xs:enumeration value="size" />
|
||||
<xs:enumeration value="category" />
|
||||
<xs:enumeration value="guid" />
|
||||
<xs:enumeration value="poster" />
|
||||
<xs:enumeration value="team" />
|
||||
<xs:enumeration value="grabs" />
|
||||
<xs:enumeration value="comments" />
|
||||
<xs:enumeration value="year" />
|
||||
<!-- TV -->
|
||||
<xs:enumeration value="season" />
|
||||
<xs:enumeration value="episode" />
|
||||
<xs:enumeration value="rageid" />
|
||||
<xs:enumeration value="tvtitle" />
|
||||
<xs:enumeration value="tvairdate" />
|
||||
<!-- TV, Movies, Audio -->
|
||||
<xs:enumeration value="video" />
|
||||
<xs:enumeration value="audio" />
|
||||
<xs:enumeration value="resolution" />
|
||||
<xs:enumeration value="framerate" />
|
||||
<xs:enumeration value="language" />
|
||||
<xs:enumeration value="subs" />
|
||||
<!-- Movies -->
|
||||
<xs:enumeration value="imdb" />
|
||||
<xs:enumeration value="imdbscore" />
|
||||
<xs:enumeration value="imdbtitle" />
|
||||
<xs:enumeration value="imdbtagline" />
|
||||
<xs:enumeration value="imdbscore" />
|
||||
<xs:enumeration value="imdbtitle" />
|
||||
<xs:enumeration value="imdbtagline" />
|
||||
<xs:enumeration value="imdbplot" />
|
||||
<xs:enumeration value="imdbyear" />
|
||||
<xs:enumeration value="imdbdirector" />
|
||||
<xs:enumeration value="imdbactors" />
|
||||
<!-- TV, Movies -->
|
||||
<xs:enumeration value="genre" />
|
||||
<!-- Music -->
|
||||
<xs:enumeration value="artist" />
|
||||
<xs:enumeration value="album" />
|
||||
<xs:enumeration value="publisher" />
|
||||
<xs:enumeration value="tracks" />
|
||||
<!-- Mixed -->
|
||||
<xs:enumeration value="coverurl" />
|
||||
<xs:enumeration value="backdropcoverurl" />
|
||||
<xs:enumeration value="review" />
|
||||
<!-- Book -->
|
||||
<xs:enumeration value="booktitle" />
|
||||
<xs:enumeration value="publishdate" />
|
||||
<xs:enumeration value="author" />
|
||||
<xs:enumeration value="pages" />
|
||||
|
||||
<!-- Generic extensions -->
|
||||
<xs:enumeration value="type" /> <!-- series|movie|music|book if unknown just omit -->
|
||||
<xs:enumeration value="tvdbid" />
|
||||
<xs:enumeration value="bannerurl" />
|
||||
|
||||
<!-- Nzb extensions -->
|
||||
<xs:enumeration value="nzbhash" /> <!-- TBD, hash of sorted article headers of relevant content (relevant excludes stuff like par,nfo,nzb etc) -->
|
||||
|
||||
<!-- Torrent extensions -->
|
||||
<xs:enumeration value="infohash" />
|
||||
<xs:enumeration value="magneturl" />
|
||||
<xs:enumeration value="seeders" />
|
||||
<xs:enumeration value="leechers" />
|
||||
<xs:enumeration value="peers" /> <!-- seeders + leechers -->
|
||||
<xs:enumeration value="seedtype" /> <!-- TBD, which criteria must be met. was going for 'ratio,seedtime,both' but afaik it's always 'either' -->
|
||||
<xs:enumeration value="minimumratio" />
|
||||
<xs:enumeration value="minimumseedtime" />
|
||||
</xs:restriction>
|
||||
</xs:simpleType>
|
||||
<xs:element name="attr">
|
||||
<xs:complexType>
|
||||
<xs:attribute name="name" type="torznab:attrNames" />
|
||||
<xs:attribute name="value" type="xs:string" />
|
||||
</xs:complexType>
|
||||
</xs:element>
|
||||
</xs:schema>
|
@ -0,0 +1,143 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<rss version="1.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:torznab="http://torznab.com/schemas/2015/feed">
|
||||
<channel>
|
||||
<atom:link href="https://hdaccess.net/api" rel="self" type="application/rss+xml" />
|
||||
<title>HDAccess</title>
|
||||
<description>HDAccess API</description>
|
||||
<link>https://hdaccess.net</link>
|
||||
<language>en-us</language>
|
||||
<webMaster>($email) (HDA Invites)</webMaster>
|
||||
<category>search</category>
|
||||
<image>
|
||||
<url>https://hdaccess.net/logo_small.png</url>
|
||||
<title>HDAccess</title>
|
||||
<link>https://hdaccess.net</link>
|
||||
<description>HDAccess API</description>
|
||||
</image>
|
||||
|
||||
<item>
|
||||
<title>Better Call Saul S01E05 Alpine Shepherd 1080p NF WEBRip DD5.1 x264</title>
|
||||
<guid isPermaLink="true">https://hdaccess.net/details.php?id=11515</guid>
|
||||
<link>https://hdaccess.net/download.php?torrent=11515&passkey=123456</link>
|
||||
<comments>https://hdaccess.net/details.php?id=11515&hit=1#comments</comments>
|
||||
<pubDate>Sat, 14 Mar 2015 17:10:42 -0400</pubDate>
|
||||
<category>HDTV 1080p</category>
|
||||
<size>2538463390</size>
|
||||
<description>Better.Call.Saul.S01E05.Alpine.Shepherd.1080p.NF.WEBRip.DD5.1.x264.torrent</description>
|
||||
<enclosure url="https://hdaccess.net/download.php?torrent=11515&passkey=123456" length="2538463390" type="application/x-bittorrent" />
|
||||
<torznab:attr name="rageid" value="37780" />
|
||||
<torznab:attr name="imdb" value="3032476" />
|
||||
<torznab:attr name="tvdbid" value="273181" />
|
||||
<torznab:attr name="category" value="5000" />
|
||||
<torznab:attr name="category" value="5040" />
|
||||
<torznab:attr name="category" value="100009" />
|
||||
<torznab:attr name="category" value="100036" />
|
||||
<torznab:attr name="type" value="series" />
|
||||
<torznab:attr name="seeders" value="7" />
|
||||
<torznab:attr name="peers" value="7" />
|
||||
<torznab:attr name="coverurl" value="https://hdaccess.net/images/posters/273181.jpg" />
|
||||
<torznab:attr name="bannerurl" value="https://hdaccess.net/images/banners/273181.jpg" />
|
||||
<torznab:attr name="infohash" value="63e07ff523710ca268567dad344ce1e0e6b7e8a3" />
|
||||
<torznab:attr name="minimumratio" value="1.0" />
|
||||
<torznab:attr name="minimumseedtime" value="172800" />
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Ocean Giants 2013 1080p 3D BluRay Remux MVC DTS-HD MA 5.1-HDAccess</title>
|
||||
<guid isPermaLink="true">https://hdaccess.net/details.php?id=11511</guid>
|
||||
<link>https://hdaccess.net/download.php?torrent=11511&passkey=123456</link>
|
||||
<comments>https://hdaccess.net/details.php?id=11511&hit=1#comments</comments>
|
||||
<pubDate>Sat, 14 Mar 2015 16:33:42 -0400</pubDate>
|
||||
<category>CUSTOM 3D BD</category>
|
||||
<size>15330508800</size>
|
||||
<description>Ocean Giants 2013 1080p 3D BluRay Remux MVC DTS-HD MA 5.1-HDAccess.torrent</description>
|
||||
<enclosure url="https://hdaccess.net/download.php?torrent=11511&passkey=123456" length="15330508800" type="application/x-bittorrent" />
|
||||
<torznab:attr name="category" value="2000" />
|
||||
<torznab:attr name="category" value="2060" />
|
||||
<torznab:attr name="category" value="100001" />
|
||||
<torznab:attr name="category" value="100018" />
|
||||
<torznab:attr name="type" value="movie" />
|
||||
<torznab:attr name="seeders" value="41" />
|
||||
<torznab:attr name="peers" value="41" />
|
||||
<torznab:attr name="coverurl" value="http://s5.postimg.org/gl7z658on/screenshot_1008.png" />
|
||||
<torznab:attr name="infohash" value="ec039a525a6feac4b15889323f4f443de381e7cc" />
|
||||
<torznab:attr name="minimumratio" value="1.0" />
|
||||
<torznab:attr name="minimumseedtime" value="172800" />
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Wild 2014 720p BluRay DTS x264-HDAccess</title>
|
||||
<guid isPermaLink="true">https://hdaccess.net/details.php?id=11506</guid>
|
||||
<link>https://hdaccess.net/download.php?torrent=11506&passkey=123456</link>
|
||||
<comments>https://hdaccess.net/details.php?id=11506&hit=1#comments</comments>
|
||||
<pubDate>Sat, 14 Mar 2015 14:28:43 -0400</pubDate>
|
||||
<category>720p</category>
|
||||
<size>6501510357</size>
|
||||
<description>Wild.2014.720p.BluRay.DTS.x264-HDAccess.torrent</description>
|
||||
<enclosure url="https://hdaccess.net/download.php?torrent=11506&passkey=123456" length="6501510357" type="application/x-bittorrent" />
|
||||
<torznab:attr name="imdb" value="2305051" />
|
||||
<torznab:attr name="category" value="2000" />
|
||||
<torznab:attr name="category" value="2060" />
|
||||
<torznab:attr name="category" value="100002" />
|
||||
<torznab:attr name="category" value="100022" />
|
||||
<torznab:attr name="type" value="movie" />
|
||||
<torznab:attr name="seeders" value="57" />
|
||||
<torznab:attr name="peers" value="58" />
|
||||
<torznab:attr name="coverurl" value="https://hdaccess.net/imdb/images/2305051.jpg" />
|
||||
<torznab:attr name="infohash" value="6704c29a00304f01b7dbb7959bfea5ccefe7d7d5" />
|
||||
<torznab:attr name="minimumratio" value="1.0" />
|
||||
<torznab:attr name="minimumseedtime" value="172800" />
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>Absolute Power 1997.1080p BluRay Remux AVC DTS-HD MA 5.1-HDX</title>
|
||||
<guid isPermaLink="true">https://hdaccess.net/details.php?id=11504</guid>
|
||||
<link>https://hdaccess.net/download.php?torrent=11504&passkey=123456</link>
|
||||
<comments>https://hdaccess.net/details.php?id=11504&hit=1#comments</comments>
|
||||
<pubDate>Sat, 14 Mar 2015 13:34:08 -0400</pubDate>
|
||||
<category>REMUX</category>
|
||||
<size>25267070253</size>
|
||||
<description>Absolute.Power.1997.1080p.BluRay.Remux.AVC.DTS-HD.MA.5.1-HDX.mkv.torrent</description>
|
||||
<enclosure url="https://hdaccess.net/download.php?torrent=11504&passkey=123456" length="25267070253" type="application/x-bittorrent" />
|
||||
<torznab:attr name="imdb" value="0118548" />
|
||||
<torznab:attr name="category" value="2000" />
|
||||
<torznab:attr name="category" value="2060" />
|
||||
<torznab:attr name="category" value="100002" />
|
||||
<torznab:attr name="category" value="100026" />
|
||||
<torznab:attr name="type" value="movie" />
|
||||
<torznab:attr name="seeders" value="6" />
|
||||
<torznab:attr name="peers" value="7" />
|
||||
<torznab:attr name="coverurl" value="https://hdaccess.net/imdb/images/0118548.jpg" />
|
||||
<torznab:attr name="infohash" value="668c1fed4b6bad43b1c84656da30d5f4eb58afdb" />
|
||||
<torznab:attr name="minimumratio" value="1.0" />
|
||||
<torznab:attr name="minimumseedtime" value="172800" />
|
||||
</item>
|
||||
|
||||
<item>
|
||||
<title>12 Monkeys S01E09 Tomorrow 720p WEB-DL DD5.1 H.264-BS</title>
|
||||
<guid isPermaLink="true">https://hdaccess.net/details.php?id=11501</guid>
|
||||
<link>https://hdaccess.net/download.php?torrent=11501&passkey=123456</link>
|
||||
<comments>https://hdaccess.net/details.php?id=11501&hit=1#comments</comments>
|
||||
<pubDate>Sat, 14 Mar 2015 12:42:19 -0400</pubDate>
|
||||
<category>TV 720p WEB-DL</category>
|
||||
<size>1397243303</size>
|
||||
<description>12.Monkeys.S01E09.Tomorrow.720p.WEB-DL.DD5.1.H.264-BS.torrent</description>
|
||||
<enclosure url="https://hdaccess.net/download.php?torrent=11501&passkey=123456" length="1397243303" type="application/x-bittorrent" />
|
||||
<torznab:attr name="rageid" value="36903" />
|
||||
<torznab:attr name="imdb" value="3148266" />
|
||||
<torznab:attr name="tvdbid" value="272644" />
|
||||
<torznab:attr name="category" value="5000" />
|
||||
<torznab:attr name="category" value="5040" />
|
||||
<torznab:attr name="category" value="100004" />
|
||||
<torznab:attr name="category" value="100038" />
|
||||
<torznab:attr name="type" value="series" />
|
||||
<torznab:attr name="seeders" value="6" />
|
||||
<torznab:attr name="peers" value="6" />
|
||||
<torznab:attr name="coverurl" value="https://hdaccess.net/images/posters/272644.jpg" />
|
||||
<torznab:attr name="bannerurl" value="https://hdaccess.net/images/banners/272644.jpg" />
|
||||
<torznab:attr name="infohash" value="9fbf7d6d52eb9847700591dad758988fb0799c53" />
|
||||
<torznab:attr name="minimumratio" value="1.0" />
|
||||
<torznab:attr name="minimumseedtime" value="172800" />
|
||||
</item>
|
||||
</channel>
|
||||
</rss>
|
@ -0,0 +1,17 @@
|
||||
using NzbDrone.Common.Exceptions;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Exceptions
|
||||
{
|
||||
public class UnsupportedFeedException : NzbDroneException
|
||||
{
|
||||
public UnsupportedFeedException(string message, params object[] args)
|
||||
: base(message, args)
|
||||
{
|
||||
}
|
||||
|
||||
public UnsupportedFeedException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,75 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using FluentValidation;
|
||||
using FluentValidation.Results;
|
||||
using NzbDrone.Common.Extensions;
|
||||
using NzbDrone.Core.Annotations;
|
||||
using NzbDrone.Core.ThingiProvider;
|
||||
using NzbDrone.Core.Validation;
|
||||
|
||||
namespace NzbDrone.Core.Indexers.Torznab
|
||||
{
|
||||
public class TorznabSettingsValidator : AbstractValidator<TorznabSettings>
|
||||
{
|
||||
private static readonly string[] ApiKeyWhiteList =
|
||||
{
|
||||
"hdaccess.net",
|
||||
};
|
||||
|
||||
private static bool ShouldHaveApiKey(TorznabSettings settings)
|
||||
{
|
||||
if (settings.Url == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return ApiKeyWhiteList.Any(c => settings.Url.ToLowerInvariant().Contains(c));
|
||||
}
|
||||
|
||||
private static readonly Regex AdditionalParametersRegex = new Regex(@"(&.+?\=.+?)+", RegexOptions.Compiled);
|
||||
|
||||
public TorznabSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c.Url).ValidRootUrl();
|
||||
RuleFor(c => c.ApiKey).NotEmpty().When(ShouldHaveApiKey);
|
||||
RuleFor(c => c.Categories).NotEmpty().When(c => !c.AnimeCategories.Any());
|
||||
RuleFor(c => c.AnimeCategories).NotEmpty().When(c => !c.Categories.Any());
|
||||
RuleFor(c => c.AdditionalParameters)
|
||||
.Matches(AdditionalParametersRegex)
|
||||
.When(c => !c.AdditionalParameters.IsNullOrWhiteSpace());
|
||||
}
|
||||
}
|
||||
|
||||
public class TorznabSettings : IProviderConfig
|
||||
{
|
||||
private static readonly TorznabSettingsValidator Validator = new TorznabSettingsValidator();
|
||||
|
||||
public TorznabSettings()
|
||||
{
|
||||
Categories = new[] { 5030, 5040 };
|
||||
AnimeCategories = Enumerable.Empty<Int32>();
|
||||
}
|
||||
|
||||
[FieldDefinition(0, Label = "URL")]
|
||||
public String Url { get; set; }
|
||||
|
||||
[FieldDefinition(1, Label = "API Key")]
|
||||
public String ApiKey { get; set; }
|
||||
|
||||
[FieldDefinition(2, Label = "Categories", HelpText = "Comma Separated list, leave blank to disable standard/daily shows", Advanced = true)]
|
||||
public IEnumerable<Int32> Categories { get; set; }
|
||||
|
||||
[FieldDefinition(3, Label = "Anime Categories", HelpText = "Comma Separated list, leave blank to disable anime", Advanced = true)]
|
||||
public IEnumerable<Int32> AnimeCategories { get; set; }
|
||||
|
||||
[FieldDefinition(4, Label = "Additional Parameters", HelpText = "Additional Torznab parameters", Advanced = true)]
|
||||
public String AdditionalParameters { get; set; }
|
||||
|
||||
public ValidationResult Validate()
|
||||
{
|
||||
return Validator.Validate(this);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue