From e41baccd02c57211557c017eb20e0394936e09d1 Mon Sep 17 00:00:00 2001 From: Taloth Saldono Date: Fri, 30 Jun 2017 23:40:16 +0200 Subject: [PATCH] New: Added AnimeTosho as Newznab and Torznab presets. --- src/NzbDrone.Core/Indexers/Newznab/Newznab.cs | 19 +++++++++++++++---- src/NzbDrone.Core/Indexers/Torznab/Torznab.cs | 15 +++++++++++++-- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs index 73a49735f..1f51a6266 100644 --- a/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs +++ b/src/NzbDrone.Core/Indexers/Newznab/Newznab.cs @@ -43,15 +43,16 @@ namespace NzbDrone.Core.Indexers.Newznab yield return GetDefinition("DrunkenSlug", GetSettings("https://api.drunkenslug.com")); yield return GetDefinition("Nzb.su", GetSettings("https://api.nzb.su")); yield return GetDefinition("NZBCat", GetSettings("https://nzb.cat")); - yield return GetDefinition("NZBFinder.ws", GetSettings("https://nzbfinder.ws", 5010, 5030, 5040, 5045)); + yield return GetDefinition("NZBFinder.ws", GetSettings("https://nzbfinder.ws", categories: new[] { 5010, 5030, 5040, 5045 })); yield return GetDefinition("NZBgeek", GetSettings("https://api.nzbgeek.info")); yield return GetDefinition("nzbplanet.net", GetSettings("https://api.nzbplanet.net")); - yield return GetDefinition("Nzbs.org", GetSettings("http://nzbs.org", 5000)); + yield return GetDefinition("Nzbs.org", GetSettings("http://nzbs.org", categories: new[] { 5000 })); yield return GetDefinition("omgwtfnzbs", GetSettings("https://api.omgwtfnzbs.me")); yield return GetDefinition("OZnzb.com", GetSettings("https://api.oznzb.com")); yield return GetDefinition("PFmonkey", GetSettings("https://www.pfmonkey.com")); yield return GetDefinition("SimplyNZBs", GetSettings("https://simplynzbs.com")); yield return GetDefinition("Usenet Crawler", GetSettings("https://www.usenet-crawler.com")); + yield return GetDefinition("AnimeTosho Usenet", GetSettings("https://animetosho.org", apiPath: @"/feed/nabapi", categories: new int[0], animeCategories: new[] { 5070 })); } } @@ -76,15 +77,25 @@ namespace NzbDrone.Core.Indexers.Newznab }; } - private NewznabSettings GetSettings(string url, params int[] categories) + private NewznabSettings GetSettings(string url, string apiPath = null, int[] categories = null, int[] animeCategories = null) { var settings = new NewznabSettings { BaseUrl = url }; - if (categories.Any()) + if (categories != null) { settings.Categories = categories; } + if (animeCategories != null) + { + settings.AnimeCategories = animeCategories; + } + + if (apiPath.IsNotNullOrWhiteSpace()) + { + settings.ApiPath = apiPath; + } + return settings; } diff --git a/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs b/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs index 5027cf6f8..d2bd2de02 100644 --- a/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs +++ b/src/NzbDrone.Core/Indexers/Torznab/Torznab.cs @@ -40,6 +40,7 @@ namespace NzbDrone.Core.Indexers.Torznab get { yield return GetDefinition("HD4Free.xyz", GetSettings("http://hd4free.xyz")); + yield return GetDefinition("AnimeTosho Torrents", GetSettings("https://animetosho.org", apiPath: @"/feed/nabapi", categories: new int[0], animeCategories: new[] { 5070 })); } } @@ -64,15 +65,25 @@ namespace NzbDrone.Core.Indexers.Torznab }; } - private TorznabSettings GetSettings(string url, params int[] categories) + private TorznabSettings GetSettings(string url, string apiPath = null, int[] categories = null, int[] animeCategories = null) { var settings = new TorznabSettings { BaseUrl = url }; - if (categories.Any()) + if (categories != null) { settings.Categories = categories; } + if (animeCategories != null) + { + settings.AnimeCategories = animeCategories; + } + + if (apiPath.IsNotNullOrWhiteSpace()) + { + settings.ApiPath = apiPath; + } + return settings; }