diff --git a/Uaflix/UaflixInvoke.cs b/Uaflix/UaflixInvoke.cs index cd65b65..03c16bd 100644 --- a/Uaflix/UaflixInvoke.cs +++ b/Uaflix/UaflixInvoke.cs @@ -500,6 +500,8 @@ namespace Uaflix return null; } + NormalizeUaflixVoiceNames(structure); + // Edge Case 9: Перевірка наявності епізодів у озвучках bool hasEpisodes = structure.Voices.Values.Any(v => v.Seasons.Values.Any(s => s.Any())); if (!hasEpisodes) @@ -888,6 +890,38 @@ namespace Uaflix 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> ParseAllZetvideoSources(string iframeUrl) { var result = new List<(string link, string quality)>(); @@ -985,4 +1019,4 @@ namespace Uaflix return TimeSpan.FromMinutes(ctime); } } -} \ No newline at end of file +}