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.
This commit is contained in:
Felix 2026-05-15 19:40:06 +03:00
parent 9e677b4113
commit a2071449f9

View File

@ -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<EpisodeItem>()
};
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);