mirror of
https://github.com/Radarr/Radarr.git
synced 2024-11-04 10:02:40 +01:00
New: Remove Anime Category for Newznab/Torznab
This commit is contained in:
parent
7120a20984
commit
22d0f9ffef
@ -1,4 +1,4 @@
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using FluentAssertions;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
@ -20,7 +20,6 @@ public void SetUp()
|
||||
{
|
||||
BaseUrl = "http://127.0.0.1:1234/",
|
||||
Categories = new[] { 1, 2 },
|
||||
AnimeCategories = new[] { 3, 4 },
|
||||
ApiKey = "abcd",
|
||||
};
|
||||
|
||||
@ -45,13 +44,13 @@ public void should_use_all_categories_for_feed()
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.Query.Should().Contain("&cat=1,2,3,4&");
|
||||
page.Url.Query.Should().Contain("&cat=1,2&");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void should_not_have_duplicate_categories()
|
||||
{
|
||||
Subject.Settings.Categories = new[] { 1, 2, 3 };
|
||||
Subject.Settings.Categories = new[] { 1, 2, 2, 3 };
|
||||
|
||||
var results = Subject.GetRecentRequests();
|
||||
|
||||
@ -59,7 +58,7 @@ public void should_not_have_duplicate_categories()
|
||||
|
||||
var page = results.GetAllTiers().First().First();
|
||||
|
||||
page.Url.FullUri.Should().Contain("&cat=1,2,3,4&");
|
||||
page.Url.FullUri.Should().Contain("&cat=1,2,3&");
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
@ -42,11 +42,11 @@ public virtual IndexerPageableRequestChain GetRecentRequests()
|
||||
// Some indexers might forget to enable movie search, but normal search still works fine. Thus we force a normal search.
|
||||
if (capabilities.SupportedMovieSearchParameters != null)
|
||||
{
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories.Concat(Settings.AnimeCategories), "movie", ""));
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "movie", ""));
|
||||
}
|
||||
else if (capabilities.SupportedSearchParameters != null)
|
||||
{
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories.Concat(Settings.AnimeCategories), "search", ""));
|
||||
pageableRequests.Add(GetPagedRequests(MaxPages, Settings.Categories, "search", ""));
|
||||
}
|
||||
|
||||
return pageableRequests;
|
||||
|
@ -38,9 +38,9 @@ public NewznabSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c).Custom((c, context) =>
|
||||
{
|
||||
if (c.Categories.Empty() && c.AnimeCategories.Empty())
|
||||
if (c.Categories.Empty())
|
||||
{
|
||||
context.AddFailure("Either 'Categories' or 'Anime Categories' must be provided");
|
||||
context.AddFailure("'Categories' must be provided");
|
||||
}
|
||||
});
|
||||
|
||||
@ -60,7 +60,6 @@ public NewznabSettings()
|
||||
{
|
||||
ApiPath = "/api";
|
||||
Categories = new[] { 2000, 2010, 2020, 2030, 2035, 2040, 2045, 2050, 2060 };
|
||||
AnimeCategories = new List<int>();
|
||||
MultiLanguages = new List<int>();
|
||||
}
|
||||
|
||||
@ -79,9 +78,6 @@ public NewznabSettings()
|
||||
[FieldDefinition(3, Label = "Categories", HelpText = "Comma Separated list, leave blank to disable all categories", Advanced = true)]
|
||||
public IEnumerable<int> Categories { get; set; }
|
||||
|
||||
[FieldDefinition(4, Label = "Anime Categories", HelpText = "Comma Separated list, leave blank to disable anime", Advanced = true)]
|
||||
public IEnumerable<int> AnimeCategories { get; set; }
|
||||
|
||||
[FieldDefinition(5, Label = "Additional Parameters", HelpText = "Additional Newznab parameters", Advanced = true)]
|
||||
public string AdditionalParameters { get; set; }
|
||||
|
||||
|
@ -33,9 +33,9 @@ public TorznabSettingsValidator()
|
||||
{
|
||||
RuleFor(c => c).Custom((c, context) =>
|
||||
{
|
||||
if (c.Categories.Empty() && c.AnimeCategories.Empty())
|
||||
if (c.Categories.Empty())
|
||||
{
|
||||
context.AddFailure("Either 'Categories' or 'Anime Categories' must be provided");
|
||||
context.AddFailure("'Categories' must be provided");
|
||||
}
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user