mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 09:22:21 +00:00
feat(makhno): add season set validation for voice selection consistency
Add logic to validate that the current voice's available seasons match the selected voice season set before generating voice links. This ensures consistent behavior when switching between voices with different season availability.
This commit is contained in:
parent
f62ed52434
commit
90574ad919
@ -279,6 +279,18 @@ namespace Makhno
|
|||||||
seasonVoiceIndexForTpl = selectedVoiceIndex;
|
seasonVoiceIndexForTpl = selectedVoiceIndex;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HashSet<int> selectedVoiceSeasonSet = null;
|
||||||
|
if (seasonVoiceIndexForTpl.HasValue)
|
||||||
|
{
|
||||||
|
selectedVoiceSeasonSet = GetSeasonsWithNumbers(playerData.Voices[seasonVoiceIndexForTpl.Value])
|
||||||
|
.Select(s => s.Number)
|
||||||
|
.ToHashSet();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
selectedVoiceSeasonSet = seasonNumbers.ToHashSet();
|
||||||
|
}
|
||||||
|
|
||||||
// Build season template for selected voice (if valid) to keep season list in sync when switching voices.
|
// Build season template for selected voice (if valid) to keep season list in sync when switching voices.
|
||||||
var seasonTplForVoice = new SeasonTpl();
|
var seasonTplForVoice = new SeasonTpl();
|
||||||
List<int> seasonNumbersForTpl = seasonNumbers;
|
List<int> seasonNumbersForTpl = seasonNumbers;
|
||||||
@ -327,7 +339,8 @@ namespace Makhno
|
|||||||
|
|
||||||
string voiceLink;
|
string voiceLink;
|
||||||
bool hasRequestedSeason = seasonsForVoice.Any(s => s.Number == requestedSeason);
|
bool hasRequestedSeason = seasonsForVoice.Any(s => s.Number == requestedSeason);
|
||||||
if (hasRequestedSeason)
|
bool sameSeasonSet = seasonsForVoice.Select(s => s.Number).ToHashSet().SetEquals(selectedVoiceSeasonSet);
|
||||||
|
if (hasRequestedSeason && sameSeasonSet)
|
||||||
{
|
{
|
||||||
voiceLink = $"{host}/makhno?imdb_id={imdb_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&season={requestedSeason}&t={i}";
|
voiceLink = $"{host}/makhno?imdb_id={imdb_id}&title={HttpUtility.UrlEncode(title)}&original_title={HttpUtility.UrlEncode(original_title)}&year={year}&serial=1&season={requestedSeason}&t={i}";
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user