From d5e9cf4f31a9c123c6f5b28cb07488c18f309576 Mon Sep 17 00:00:00 2001 From: FalloNero Date: Tue, 18 Mar 2025 13:00:53 +0100 Subject: [PATCH] Update youtube.lua --- youtube.lua | 35 ++++++++++++++++++++++------------- 1 file changed, 22 insertions(+), 13 deletions(-) diff --git a/youtube.lua b/youtube.lua index e977ffb..415c186 100644 --- a/youtube.lua +++ b/youtube.lua @@ -33,23 +33,32 @@ function parse() handle:close() -- Trim any whitespace - video_url = video_url:gsub("^%s+", ""):gsub("%s+$", "") - audio_url = audio_url:gsub("^%s+", ""):gsub("%s+$", "") + video_url = video_url and video_url:gsub("^%s+", ""):gsub("%s+$", "") or "" + audio_url = audio_url and audio_url:gsub("^%s+", ""):gsub("%s+$", "") or "" -- Log the resolved URLs vlc.msg.info("[YouTube Resolver] Original URL: " .. youtube_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 - return { - { - path = video_url, - name = vlc.path .. " (Video)", - options = { - -- Add audio URL as input option - ":input-slave=" .. audio_url + if audio_url and audio_url ~= "" then + vlc.msg.info("[YouTube Resolver] Audio URL: " .. audio_url) + return { + { + path = video_url, + name = vlc.path .. " (Video)", + options = { + -- Add audio URL as input option + ":input-slave=" .. audio_url + } } } - } -end \ No newline at end of file + 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