From e3659bee91bf9d9ad3a96053b04c01d5c097f2b6 Mon Sep 17 00:00:00 2001 From: Bogdan Date: Tue, 31 Dec 2024 02:10:27 +0200 Subject: [PATCH] animebytes: include year in release title for series with year in filenames --- src/Jackett.Common/Indexers/Definitions/AnimeBytes.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Jackett.Common/Indexers/Definitions/AnimeBytes.cs b/src/Jackett.Common/Indexers/Definitions/AnimeBytes.cs index 7cbd2668d..49553b76e 100644 --- a/src/Jackett.Common/Indexers/Definitions/AnimeBytes.cs +++ b/src/Jackett.Common/Indexers/Definitions/AnimeBytes.cs @@ -278,7 +278,7 @@ namespace Jackett.Common.Indexers.Definitions { var categoryName = group.Value("CategoryName"); var description = group.Value("Description"); - var year = group.Value("Year"); + var year = group.Value("Year"); var posterStr = group.Value("Image"); var poster = posterStr.IsNotNullOrWhiteSpace() ? new Uri(posterStr) : null; var groupName = group.Value("GroupName"); @@ -573,11 +573,13 @@ namespace Jackett.Common.Indexers.Definitions var infoString = properties.Select(p => "[" + p + "]").Join(string.Empty); + var useYearInTitle = year is > 0 && torrent.Value("FileList").Any(f => f.Value("filename").Contains(year.Value.ToString())); + foreach (var title in synonyms) { var releaseTitle = groupName is "Movie" or "Live Action Movie" ? $"{releaseGroup}{title} {year} {infoString}" : - $"{releaseGroup}{title} {releaseInfo} {infoString}"; + $"{releaseGroup}{title}{(useYearInTitle ? $" {year}" : string.Empty)} {releaseInfo} {infoString}"; var guid = new Uri(details + "&nh=" + StringUtil.Hash(title)); @@ -677,7 +679,7 @@ namespace Jackett.Common.Indexers.Definitions { var advancedSeasonRegex = new Regex(@"\b(?:(?\d+)(?:st|nd|rd|th) Season|Season (?\d+))\b", RegexOptions.Compiled | RegexOptions.IgnoreCase); var seasonCharactersRegex = new Regex(@"(I{2,})$", RegexOptions.Compiled); - var seasonNumberRegex = new Regex(@"\b(?[2-9])$", RegexOptions.Compiled); + var seasonNumberRegex = new Regex(@"\b(?[2-9])$", RegexOptions.Compiled); foreach (var title in titles) {