mirror of
https://github.com/Jackett/Jackett.git
synced 2025-09-17 17:34:09 +02:00
animebytes: ignore useless extensions to improve single file names (#14266)
This commit is contained in:
@@ -51,6 +51,7 @@ namespace Jackett.Common.Indexers
|
|||||||
"RAW",
|
"RAW",
|
||||||
"Translated"
|
"Translated"
|
||||||
};
|
};
|
||||||
|
private static readonly HashSet<string> _ExcludedFileExtensions = new HashSet<string>(StringComparer.OrdinalIgnoreCase) { ".mka", ".mds", ".md5", ".nfo", ".sfv", ".ass", ".mks", ".srt", ".ssa", ".sup", ".jpeg", ".jpg", ".png", ".otf", ".ttf" };
|
||||||
|
|
||||||
private ConfigurationDataAnimeBytes ConfigData => (ConfigurationDataAnimeBytes)configData;
|
private ConfigurationDataAnimeBytes ConfigData => (ConfigurationDataAnimeBytes)configData;
|
||||||
|
|
||||||
@@ -595,9 +596,21 @@ namespace Jackett.Common.Indexers
|
|||||||
releases.Add(release);
|
releases.Add(release);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AddFileNameTitles && fileCount == 1)
|
if (AddFileNameTitles && torrent.Value<JToken>("FileList") != null)
|
||||||
{
|
{
|
||||||
var releaseTitle = Path.GetFileNameWithoutExtension(torrent.Value<JToken>("FileList")?.First().Value<string>("filename"));
|
var files = torrent.Value<JToken>("FileList").ToList();
|
||||||
|
|
||||||
|
if (files.Count > 1)
|
||||||
|
{
|
||||||
|
files = files.Where(f => !_ExcludedFileExtensions.Contains(Path.GetExtension(f.Value<string>("filename")))).ToList();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (files.Count != 1)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
var releaseTitle = files.First().Value<string>("filename");
|
||||||
|
|
||||||
var guid = new Uri(details + "&nh=" + StringUtil.Hash(releaseTitle));
|
var guid = new Uri(details + "&nh=" + StringUtil.Hash(releaseTitle));
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user