Update youtube.lua

This commit is contained in:
FalloNero
2025-03-18 13:00:53 +01:00
committed by GitHub
parent 8aaa0516d1
commit d5e9cf4f31

View File

@@ -33,23 +33,32 @@ function parse()
handle:close() handle:close()
-- Trim any whitespace -- Trim any whitespace
video_url = video_url:gsub("^%s+", ""):gsub("%s+$", "") video_url = video_url and video_url:gsub("^%s+", ""):gsub("%s+$", "") or ""
audio_url = audio_url:gsub("^%s+", ""):gsub("%s+$", "") audio_url = audio_url and audio_url:gsub("^%s+", ""):gsub("%s+$", "") or ""
-- Log the resolved URLs -- Log the resolved URLs
vlc.msg.info("[YouTube Resolver] Original URL: " .. youtube_url) vlc.msg.info("[YouTube Resolver] Original URL: " .. youtube_url)
vlc.msg.info("[YouTube Resolver] Video URL: " .. video_url) vlc.msg.info("[YouTube Resolver] Video URL: " .. video_url)
vlc.msg.info("[YouTube Resolver] Audio URL: " .. audio_url)
-- Create a playlist item with both video and audio URLs if audio_url and audio_url ~= "" then
return { vlc.msg.info("[YouTube Resolver] Audio URL: " .. audio_url)
{ return {
path = video_url, {
name = vlc.path .. " (Video)", path = video_url,
options = { name = vlc.path .. " (Video)",
-- Add audio URL as input option options = {
":input-slave=" .. audio_url -- Add audio URL as input option
":input-slave=" .. audio_url
}
} }
} }
} else
vlc.msg.warn("[YouTube Resolver] No separate audio URL found. Playing single URL with both video and audio.")
return {
{
path = video_url,
name = vlc.path .. " (Video + Audio)"
}
}
end
end end