From 2236f3029d64a66af63e65a043846499970a1274 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Thu, 20 Apr 2023 04:16:04 +0300 Subject: [PATCH] animebytes: add `Remux` to release titles when possible --- src/Jackett.Common/Indexers/AnimeBytes.cs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Jackett.Common/Indexers/AnimeBytes.cs b/src/Jackett.Common/Indexers/AnimeBytes.cs index 473293bae..1e7e28ad3 100644 --- a/src/Jackett.Common/Indexers/AnimeBytes.cs +++ b/src/Jackett.Common/Indexers/AnimeBytes.cs @@ -42,12 +42,9 @@ namespace Jackett.Common.Indexers private static Regex YearRegex => new Regex(@"\b((?:19|20)\d{2})$", RegexOptions.Compiled); - private readonly HashSet _excludedProperties = new HashSet(StringComparer.OrdinalIgnoreCase) - { - "Freeleech" - }; - - private readonly HashSet _commonReleaseGroupsProperties = new HashSet(StringComparer.OrdinalIgnoreCase) + private static readonly HashSet _ExcludedProperties = new HashSet(StringComparer.OrdinalIgnoreCase) { "Freeleech" }; + private static readonly HashSet _RemuxResolutions = new HashSet(StringComparer.OrdinalIgnoreCase) { "1080i", "1080p", "2160p", "4K" }; + private static readonly HashSet _CommonReleaseGroupsProperties = new HashSet(StringComparer.OrdinalIgnoreCase) { "Softsubs", "Hardsubs", @@ -383,9 +380,17 @@ namespace Jackett.Common.Indexers .Where(p => p.IsNotNullOrWhiteSpace()) .ToList(); - propertyList.RemoveAll(p => _excludedProperties.Any(p.ContainsIgnoreCase)); + propertyList.RemoveAll(p => _ExcludedProperties.Any(p.ContainsIgnoreCase)); var properties = new HashSet(propertyList); + if (torrent.Value("FileList") != null && + torrent.Value("FileList").Any(f => f.Value("filename").ContainsIgnoreCase("Remux"))) + { + var resolutionProperty = properties.FirstOrDefault(_RemuxResolutions.ContainsIgnoreCase); + + properties.Add(resolutionProperty.IsNotNullOrWhiteSpace() ? $"{resolutionProperty} Remux" : "Remux"); + } + if (properties.Any(p => p.StartsWithIgnoreCase("M2TS"))) { properties.Add("BR-DISK"); @@ -528,9 +533,9 @@ namespace Jackett.Common.Indexers } // We don't actually have a release name >.> so try to create one - var releaseGroup = properties.LastOrDefault(p => _commonReleaseGroupsProperties.Any(p.StartsWithIgnoreCase)); + var releaseGroup = properties.LastOrDefault(p => _CommonReleaseGroupsProperties.Any(p.StartsWithIgnoreCase) && p.Contains("(") && p.Contains(")")); - if (releaseGroup.IsNotNullOrWhiteSpace() && releaseGroup.Contains("(") && releaseGroup.Contains(")")) + if (releaseGroup.IsNotNullOrWhiteSpace()) { var start = releaseGroup.IndexOf("(", StringComparison.Ordinal); releaseGroup = "[" + releaseGroup.Substring(start + 1, releaseGroup.IndexOf(")", StringComparison.Ordinal) - 1 - start) + "] ";