From ea4d0fe7015108ce056c407e60cda13a488d4698 Mon Sep 17 00:00:00 2001 From: Azerelat <azerelat@inbox.lv> Date: Sat, 16 Jan 2016 22:36:03 +0000 Subject: [PATCH] AnimeBytes Sonarr Fix (Will only fix season 1 but we don't have season info). --- src/Jackett/Indexers/AnimeBytes.cs | 18 +++++++++++++++++- .../Bespoke/ConfigurationDataAnimeBytes.cs | 2 ++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/src/Jackett/Indexers/AnimeBytes.cs b/src/Jackett/Indexers/AnimeBytes.cs index 8ee9492e..9d537898 100644 --- a/src/Jackett/Indexers/AnimeBytes.cs +++ b/src/Jackett/Indexers/AnimeBytes.cs @@ -27,6 +27,7 @@ namespace Jackett.Indexers private string LoginUrl { get { return SiteLink + "user/login"; } } private string SearchUrl { get { return SiteLink + "torrents.php?"; } } public bool AllowRaws { get { return configData.IncludeRaw.Value; } } + public bool InsertSeason { get { return configData.InsertSeason!=null && configData.InsertSeason.Value; } } new ConfigurationDataAnimeBytes configData { @@ -53,6 +54,13 @@ namespace Jackett.Indexers } + + public IEnumerable<ReleaseInfo> FilterResults(TorznabQuery query, IEnumerable<ReleaseInfo> input) + { + // Prevent filtering + return input; + } + public async Task<IndexerConfigurationStatus> ApplyConfiguration(JToken configJson) { configData.LoadValuesFromJson(configJson); @@ -122,7 +130,9 @@ namespace Jackett.Indexers private string StripEpisodeNumber(string term) { // Tracer does not support searching with episode number so strip it if we have one - return Regex.Replace(term, @"\W(\dx)?\d?\d$", string.Empty); + term = Regex.Replace(term, @"\W(\dx)?\d?\d$", string.Empty); + term = Regex.Replace(term, @"\W(S\d\d?E)?\d?\d$", string.Empty); + return term; } public async Task<IEnumerable<ReleaseInfo>> PerformQuery(TorznabQuery query) @@ -242,6 +252,12 @@ namespace Jackett.Indexers releaseInfo = releaseInfo.Replace("Episode ", ""); releaseInfo = releaseInfo.Replace("Season ", "S"); releaseInfo = releaseInfo.Trim(); + int test = 0; + if (InsertSeason && int.TryParse(releaseInfo, out test) && releaseInfo.Length==1) + { + releaseInfo = "S01E0" + releaseInfo; + } + } else if (rowCq.HasClass("torrent")) { diff --git a/src/Jackett/Models/IndexerConfig/Bespoke/ConfigurationDataAnimeBytes.cs b/src/Jackett/Models/IndexerConfig/Bespoke/ConfigurationDataAnimeBytes.cs index 85823982..1c009acc 100644 --- a/src/Jackett/Models/IndexerConfig/Bespoke/ConfigurationDataAnimeBytes.cs +++ b/src/Jackett/Models/IndexerConfig/Bespoke/ConfigurationDataAnimeBytes.cs @@ -11,12 +11,14 @@ namespace Jackett.Models.IndexerConfig.Bespoke { public BoolItem IncludeRaw { get; private set; } public DisplayItem DateWarning { get; private set; } + public BoolItem InsertSeason { get; private set; } public ConfigurationDataAnimeBytes() : base() { IncludeRaw = new BoolItem() { Name = "IncludeRaw", Value = false }; DateWarning = new DisplayItem("This tracker does not supply upload dates so they are based off year of release.") { Name = "DateWarning" }; + InsertSeason = new BoolItem() { Name = "Prefix episode number with S01 for Sonarr Compatability", Value = false }; } } } -- GitLab