fix(jacktor): use season-specific extracted year in search URLs

Previously, the same year parameter was used for all seasons in generated
search links. The change calculates a distinct year per season by finding
the minimum ExtractedYear from torrents that contain that season and have
a valid year (>1900), falling back to the provided year when no matches
exist. This improves the accuracy of search results for multi-season
content where seasons may have different release years.
This commit is contained in:
Felix 2026-05-05 22:01:02 +03:00
parent 5829c65426
commit adfa97e810

View File

@ -95,9 +95,15 @@ namespace LME.JackTor.Controllers
var seasonTpl = new SeasonTpl(quality: quality);
foreach (int season in seasons)
{
int seasonYear = torrents
.Where(i => i.Seasons != null && i.Seasons.Contains(season) && i.ExtractedYear > 1900)
.Select(i => i.ExtractedYear)
.DefaultIfEmpty(year)
.Min();
seasonTpl.Append(
$"{season} сезон",
$"{host}/lite/lme_jacktor?rjson={rjson}&title={enTitle}&original_title={enOriginal}&year={year}&original_language={original_language}&serial=1&s={season}",
$"{host}/lite/lme_jacktor?rjson={rjson}&title={enTitle}&original_title={enOriginal}&year={seasonYear}&original_language={original_language}&serial=1&s={season}",
season);
}