Fixed: (AnimeBytes) Ignore useless extensions to improve single file names

pull/1606/head
Bogdan 2 years ago
parent d3ca861aea
commit 025156978b

@ -2,6 +2,7 @@ using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net;
using System.Text;
@ -223,8 +224,6 @@ namespace NzbDrone.Core.Indexers.Definitions
public class AnimeBytesParser : IParseIndexerResponse
{
private readonly AnimeBytesSettings _settings;
private static readonly HashSet<string> ExcludedProperties = new (StringComparer.OrdinalIgnoreCase) { "Freeleech" };
private static readonly HashSet<string> RemuxResolutions = new (StringComparer.OrdinalIgnoreCase) { "1080i", "1080p", "2160p", "4K" };
private static readonly HashSet<string> CommonReleaseGroupsProperties = new (StringComparer.OrdinalIgnoreCase)
@ -234,6 +233,9 @@ namespace NzbDrone.Core.Indexers.Definitions
"RAW",
"Translated"
};
private static readonly HashSet<string> ExcludedFileExtensions = new (StringComparer.OrdinalIgnoreCase) { ".mka", ".mds", ".md5", ".nfo", ".sfv", ".ass", ".mks", ".srt", ".ssa", ".sup", ".jpeg", ".jpg", ".png", ".otf", ".ttf" };
private readonly AnimeBytesSettings _settings;
public AnimeBytesParser(AnimeBytesSettings settings)
{
@ -497,9 +499,18 @@ namespace NzbDrone.Core.Indexers.Definitions
var infoString = properties.Select(p => "[" + p + "]").Join(string.Empty);
if (_settings.UseFilenameForSingleEpisodes && torrent.FileCount == 1)
if (_settings.UseFilenameForSingleEpisodes)
{
var files = torrent.Files;
if (files.Count > 1)
{
var fileName = torrent.Files.First().FileName;
files = files.Where(f => !ExcludedFileExtensions.Contains(Path.GetExtension(f.FileName))).ToList();
}
if (files.Count == 1)
{
var fileName = files.First().FileName;
var guid = new Uri(details + "?nh=" + HashUtil.CalculateMd5(fileName));
@ -527,6 +538,7 @@ namespace NzbDrone.Core.Indexers.Definitions
continue;
}
}
foreach (var title in synonyms)
{

Loading…
Cancel
Save