Fix BjShare title formatting

This commit is contained in:
Leandro Battochio 2026-04-09 23:16:37 -03:00
parent 719d281ad7
commit 2000d0c768

View file

@ -448,7 +448,7 @@ private static string BuildReleaseTitle(string title, int? year, string seasonEp
cleanInfo = cleanInfo.Replace("Full HD", "1080p");
cleanInfo = cleanInfo.Replace("4K", "2160p");
cleanInfo = cleanInfo.Replace("SD", "480p");
cleanInfo = Regex.Replace(cleanInfo, @"(^|/\s*)HD(?=\s*/|$)", "$1720p", RegexOptions.IgnoreCase);
cleanInfo = Regex.Replace(cleanInfo, @"(^|/\s*)HD(?=\s*/|$)", "${1}720p", RegexOptions.IgnoreCase);
cleanInfo = cleanInfo.Replace(" / Free", "");
cleanInfo = Regex.Replace(cleanInfo, @"\s+", " ").Trim();
@ -462,7 +462,13 @@ private static string BuildReleaseTitle(string title, int? year, string seasonEp
seasonEpisode = string.Empty;
}
return $"{title} {(year.HasValue ? year.Value.ToString(CultureInfo.InvariantCulture) : string.Empty)} {seasonEpisode} {cleanInfo}".Trim();
return string.Join(" ", new[]
{
title,
year?.ToString(CultureInfo.InvariantCulture),
seasonEpisode,
cleanInfo
}.Where(x => !string.IsNullOrWhiteSpace(x)));
}
private static (int Seeders, int Peers) ParsePeerStats(IElement row)