From 3c09f67f376b3987f2fbd06b67427f94f02dcdb2 Mon Sep 17 00:00:00 2001 From: lunanon <219226627+lunanon@users.noreply.github.com> Date: Fri, 4 Jul 2025 18:21:34 -0400 Subject: [PATCH] Fixed: (AnimeBytes) Categorization and filtering of adult content --- .../Indexers/Definitions/AnimeBytes.cs | 26 +++++++++++++++---- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs b/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs index 4468e1c05..8f8b6aab9 100644 --- a/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs +++ b/src/NzbDrone.Core/Indexers/Definitions/AnimeBytes.cs @@ -139,6 +139,7 @@ private IndexerCapabilities SetCapabilities() caps.Categories.AddCategoryMapping("printedtype[manhwa]", NewznabStandardCategory.BooksComics, "Manhwa"); caps.Categories.AddCategoryMapping("printedtype[light_novel]", NewznabStandardCategory.BooksComics, "Light Novel"); caps.Categories.AddCategoryMapping("printedtype[artbook]", NewznabStandardCategory.BooksComics, "Artbook"); + caps.Categories.AddCategoryMapping("", NewznabStandardCategory.XXX, "Hentai"); return caps; } @@ -245,9 +246,9 @@ private IEnumerable GetRequest(SearchCriteriaBase searchCriteria parameters.Set("freeleech", "1"); } - if (_settings.ExcludeHentai && searchType == "anime") + if (searchType == "anime") { - parameters.Set("hentai", "0"); + parameters.Set("hentai", _settings.ShowHentai.ToString()); } searchUrl += "?" + parameters.GetQueryString(); @@ -720,7 +721,7 @@ public AnimeBytesSettings() Passkey = ""; FreeleechOnly = false; ExcludeRaw = false; - ExcludeHentai = false; + ShowHentai = (int)AnimeBytesHentaiAction.Include; SearchByYear = false; EnableSonarrCompatibility = true; UseFilenameForSingleEpisodes = true; @@ -741,8 +742,8 @@ public AnimeBytesSettings() [FieldDefinition(5, Label = "Exclude RAW", Type = FieldType.Checkbox, HelpText = "Exclude RAW torrents from results")] public bool ExcludeRaw { get; set; } - [FieldDefinition(6, Label = "Exclude Hentai", Type = FieldType.Checkbox, HelpText = "Exclude Hentai torrents from results")] - public bool ExcludeHentai { get; set; } + [FieldDefinition(6, Label = "Search Hentai", Type = FieldType.Select, SelectOptions = typeof(AnimeBytesHentaiAction), HelpText = "Exclude, include, or include only Hentai in search")] + public int ShowHentai { get; set; } [FieldDefinition(7, Label = "Search By Year", Type = FieldType.Checkbox, HelpText = "Makes Prowlarr to search by year as a different argument in the request.")] public bool SearchByYear { get; set; } @@ -768,6 +769,21 @@ public override NzbDroneValidationResult Validate() } } + public enum AnimeBytesHentaiAction + { + [FieldOption(Label = "Include", Hint = "Include hentai in the search results")] + Include = 2, + + [FieldOption(Label = "Exclude", Hint = "Exclude hentai from the search results")] + Preferred = 0, + + [FieldOption(Label = "Include Only", Hint = "Include only hentai in the search results")] + IncludeOnly = 1, + + [FieldOption(Label = "Include Uncensored Only", Hint = "Include only uncensored hentai in the search results")] + IncludeUncensoredOnly = 3, + } + public class AnimeBytesResponse { [JsonPropertyName("Matches")]