mirror of
https://github.com/lampame/lampac-ukraine.git
synced 2026-04-16 17:32:20 +00:00
feat(uaflix): normalize voice names in aggregated structure
Add NormalizeUaflixVoiceNames method to standardize voice naming by converting "Uaflix #2" or "Uaflix #3" to "Uaflix" when base name is missing. This ensures consistent voice naming across the system. The method checks for existing voice keys and renames them appropriately to maintain a single canonical voice name.
This commit is contained in:
parent
768c916b1d
commit
60d7b15dc1
@ -500,6 +500,8 @@ namespace Uaflix
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
NormalizeUaflixVoiceNames(structure);
|
||||||
|
|
||||||
// Edge Case 9: Перевірка наявності епізодів у озвучках
|
// Edge Case 9: Перевірка наявності епізодів у озвучках
|
||||||
bool hasEpisodes = structure.Voices.Values.Any(v => v.Seasons.Values.Any(s => s.Any()));
|
bool hasEpisodes = structure.Voices.Values.Any(v => v.Seasons.Values.Any(s => s.Any()));
|
||||||
if (!hasEpisodes)
|
if (!hasEpisodes)
|
||||||
@ -888,6 +890,38 @@ namespace Uaflix
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void NormalizeUaflixVoiceNames(SerialAggregatedStructure structure)
|
||||||
|
{
|
||||||
|
const string baseName = "Uaflix";
|
||||||
|
const string zetName = "Uaflix #2";
|
||||||
|
const string ashdiName = "Uaflix #3";
|
||||||
|
|
||||||
|
if (structure == null || structure.Voices == null || structure.Voices.Count == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool hasBase = structure.Voices.ContainsKey(baseName);
|
||||||
|
bool hasZet = structure.Voices.ContainsKey(zetName);
|
||||||
|
bool hasAshdi = structure.Voices.ContainsKey(ashdiName);
|
||||||
|
|
||||||
|
if (hasBase)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (hasZet && !hasAshdi)
|
||||||
|
{
|
||||||
|
var voice = structure.Voices[zetName];
|
||||||
|
voice.DisplayName = baseName;
|
||||||
|
structure.Voices.Remove(zetName);
|
||||||
|
structure.Voices[baseName] = voice;
|
||||||
|
}
|
||||||
|
else if (hasAshdi && !hasZet)
|
||||||
|
{
|
||||||
|
var voice = structure.Voices[ashdiName];
|
||||||
|
voice.DisplayName = baseName;
|
||||||
|
structure.Voices.Remove(ashdiName);
|
||||||
|
structure.Voices[baseName] = voice;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async Task<List<(string link, string quality)>> ParseAllZetvideoSources(string iframeUrl)
|
async Task<List<(string link, string quality)>> ParseAllZetvideoSources(string iframeUrl)
|
||||||
{
|
{
|
||||||
var result = new List<(string link, string quality)>();
|
var result = new List<(string link, string quality)>();
|
||||||
@ -985,4 +1019,4 @@ namespace Uaflix
|
|||||||
return TimeSpan.FromMinutes(ctime);
|
return TimeSpan.FromMinutes(ctime);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user