1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-03-04 18:59:01 +00:00

animebytes: add Remux to release titles when possible

This commit is contained in:
Bogdan 2023-04-20 04:16:04 +03:00
parent f3cc62be91
commit 2236f3029d

View file

@ -42,12 +42,9 @@ namespace Jackett.Common.Indexers
private static Regex YearRegex => new Regex(@"\b((?:19|20)\d{2})$", RegexOptions.Compiled);
private readonly HashSet<string> _excludedProperties = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
{
"Freeleech"
};
private readonly HashSet<string> _commonReleaseGroupsProperties = new HashSet<string>(StringComparer.OrdinalIgnoreCase)
private static readonly HashSet<string> _ExcludedProperties = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "Freeleech" };
private static readonly HashSet<string> _RemuxResolutions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { "1080i", "1080p", "2160p", "4K" };
private static readonly HashSet<string> _CommonReleaseGroupsProperties = new HashSet<string>(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<string>(propertyList);
if (torrent.Value<JToken>("FileList") != null &&
torrent.Value<JToken>("FileList").Any(f => f.Value<string>("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) + "] ";