1
0
Fork 0
mirror of https://github.com/Jackett/Jackett synced 2025-03-04 10:48:26 +00:00

animebytes: improve M2TS and ISO titles for BR-DISK detection

This commit is contained in:
Bogdan 2025-01-12 19:02:51 +02:00
parent deff1196af
commit cfce8f987f
2 changed files with 33 additions and 15 deletions

View file

@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace Jackett.Common.Extensions
{
public static class IEnumerableExtensions
{
public static HashSet<T> ToHashSet<T>(this IEnumerable<T> source, IEqualityComparer<T> comparer = null) => new (source, comparer);
}
}

View file

@ -348,30 +348,39 @@ namespace Jackett.Common.Indexers.Definitions
.ToList();
propertyList.RemoveAll(p => _ExcludedProperties.Any(p.ContainsIgnoreCase));
var properties = new HashSet<string>(propertyList);
var properties = propertyList.ToHashSet();
if (torrent.Files.Any(f => f.FileName.ContainsIgnoreCase("Remux")))
{
var resolutionProperty = properties.FirstOrDefault(_RemuxResolutions.ContainsIgnoreCase);
if (resolutionProperty.IsNotNullOrWhiteSpace())
{
properties.Add($"{resolutionProperty} Remux");
}
}
if (properties.Any(p => p.StartsWithIgnoreCase("M2TS")))
if (properties.Any(p => p.ContainsIgnoreCase("M2TS")))
{
properties.Add("BR-DISK");
}
if (!AllowRaws &&
categoryName == "Anime" &&
properties.Any(p => p.StartsWithIgnoreCase("RAW") || p.Contains("BR-DISK")))
var isBluRayDisk = properties.Any(p => p.ContainsIgnoreCase("RAW") || p.ContainsIgnoreCase("M2TS") || p.ContainsIgnoreCase("ISO"));
if (!AllowRaws && categoryName == "Anime" && isBluRayDisk)
{
continue;
}
properties = properties
.Select(property =>
{
if (isBluRayDisk)
{
property = Regex.Replace(property, @"\b(H\.?265)\b", "HEVC", RegexOptions.Compiled | RegexOptions.IgnoreCase);
property = Regex.Replace(property, @"\b(H\.?264)\b", "AVC", RegexOptions.Compiled | RegexOptions.IgnoreCase);
}
if (torrent.Files.Any(f => f.FileName.ContainsIgnoreCase("Remux"))
&& _RemuxResolutions.ContainsIgnoreCase(property))
{
property += " Remux";
}
return property;
})
.ToHashSet();
int? season = null;
int? episode = null;