New: Added AnimeTosho as Newznab and Torznab presets.

This commit is contained in:
Taloth Saldono 2017-06-30 23:40:16 +02:00
parent fef3423019
commit e41baccd02
2 changed files with 28 additions and 6 deletions

View File

@ -43,15 +43,16 @@ namespace NzbDrone.Core.Indexers.Newznab
yield return GetDefinition("DrunkenSlug", GetSettings("https://api.drunkenslug.com")); yield return GetDefinition("DrunkenSlug", GetSettings("https://api.drunkenslug.com"));
yield return GetDefinition("Nzb.su", GetSettings("https://api.nzb.su")); yield return GetDefinition("Nzb.su", GetSettings("https://api.nzb.su"));
yield return GetDefinition("NZBCat", GetSettings("https://nzb.cat")); 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("NZBgeek", GetSettings("https://api.nzbgeek.info"));
yield return GetDefinition("nzbplanet.net", GetSettings("https://api.nzbplanet.net")); 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("omgwtfnzbs", GetSettings("https://api.omgwtfnzbs.me"));
yield return GetDefinition("OZnzb.com", GetSettings("https://api.oznzb.com")); yield return GetDefinition("OZnzb.com", GetSettings("https://api.oznzb.com"));
yield return GetDefinition("PFmonkey", GetSettings("https://www.pfmonkey.com")); yield return GetDefinition("PFmonkey", GetSettings("https://www.pfmonkey.com"));
yield return GetDefinition("SimplyNZBs", GetSettings("https://simplynzbs.com")); yield return GetDefinition("SimplyNZBs", GetSettings("https://simplynzbs.com"));
yield return GetDefinition("Usenet Crawler", GetSettings("https://www.usenet-crawler.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 }; var settings = new NewznabSettings { BaseUrl = url };
if (categories.Any()) if (categories != null)
{ {
settings.Categories = categories; settings.Categories = categories;
} }
if (animeCategories != null)
{
settings.AnimeCategories = animeCategories;
}
if (apiPath.IsNotNullOrWhiteSpace())
{
settings.ApiPath = apiPath;
}
return settings; return settings;
} }

View File

@ -40,6 +40,7 @@ namespace NzbDrone.Core.Indexers.Torznab
get get
{ {
yield return GetDefinition("HD4Free.xyz", GetSettings("http://hd4free.xyz")); 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 }; var settings = new TorznabSettings { BaseUrl = url };
if (categories.Any()) if (categories != null)
{ {
settings.Categories = categories; settings.Categories = categories;
} }
if (animeCategories != null)
{
settings.AnimeCategories = animeCategories;
}
if (apiPath.IsNotNullOrWhiteSpace())
{
settings.ApiPath = apiPath;
}
return settings; return settings;
} }