From a2071449f944f62f4ff13619d1c3a52e010faae9 Mon Sep 17 00:00:00 2001 From: Felix Date: Fri, 15 May 2026 19:40:06 +0300 Subject: [PATCH] fix(uakino): group movie stream entries when voice tabs are absent Handle playlist items differently when `playlists-lists` voice tabs are missing so film pages no longer collapse multiple stream versions into a single fallback voice group. When tabs are absent, treat each `li` as a stream variant and resolve its target voice by `data-voice` (or item text) with on-demand group creation. Keep existing tab-based matching logic unchanged for serial/episode layouts. --- LME.UAKino/UAKinoInvoke.cs | 36 +++++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 7 deletions(-) diff --git a/LME.UAKino/UAKinoInvoke.cs b/LME.UAKino/UAKinoInvoke.cs index 5728900..7984283 100644 --- a/LME.UAKino/UAKinoInvoke.cs +++ b/LME.UAKino/UAKinoInvoke.cs @@ -461,7 +461,8 @@ namespace LME.UAKino // Парсимо голоси (озвучки) з вкладки playlists-lists var voiceItems = playerDiv.SelectNodes(".//div[@class='playlists-lists']//ul/li"); - if (voiceItems != null) + bool hasVoiceTabs = voiceItems != null && voiceItems.Count > 0; + if (hasVoiceTabs) { foreach (var li in voiceItems) { @@ -496,14 +497,35 @@ namespace LME.UAKino VoiceGroup targetVoice = null; - if (!string.IsNullOrEmpty(dataId)) - targetVoice = voices.FirstOrDefault(v => v.DataId == dataId); - - if (targetVoice == null && !string.IsNullOrEmpty(voiceAttr)) + if (!hasVoiceTabs) + { + // Фільм: вкладок голосів нема — кожен li це окремий стрім (версія) + // Групуємо за data-voice або створюємо нову групу + string groupName = !string.IsNullOrEmpty(voiceAttr) ? voiceAttr : text; targetVoice = voices.FirstOrDefault(v => - v.Name.Equals(voiceAttr, StringComparison.OrdinalIgnoreCase)); + v.Name.Equals(groupName, StringComparison.OrdinalIgnoreCase)); + if (targetVoice == null) + { + targetVoice = new VoiceGroup + { + Name = groupName, + DataId = dataId, + Episodes = new List() + }; + voices.Add(targetVoice); + } + } + else + { + if (!string.IsNullOrEmpty(dataId)) + targetVoice = voices.FirstOrDefault(v => v.DataId == dataId); - targetVoice ??= voices.FirstOrDefault(); + if (targetVoice == null && !string.IsNullOrEmpty(voiceAttr)) + targetVoice = voices.FirstOrDefault(v => + v.Name.Equals(voiceAttr, StringComparison.OrdinalIgnoreCase)); + + targetVoice ??= voices.FirstOrDefault(); + } int? epNum = ExtractEpisodeNumber(text);