diff --git a/README.md b/README.md index ba4f39b..73c56de 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,8 @@ To adjust options, simply change the values inside `local options` within the sc local options = { -- Which domains should ytdl-format change on? domains = { - "youtu.be", "youtube.com", "www.youtube.com", - "twitch.tv", "www.twitch.tv" + "youtu.be", "youtube.com", "www.youtube.com", + "twitch.tv", "www.twitch.tv", }, -- Set maximum video quality (on load/start) diff --git a/ytdlautoformat.lua b/ytdlautoformat.lua index 615aceb..80b8502 100644 --- a/ytdlautoformat.lua +++ b/ytdlautoformat.lua @@ -48,10 +48,15 @@ local function update_ytdl_format() ["av1"] = "[vcodec~='^(av01)']", ["novp9"] = "[vcodec!~='^(vp0?9)']", } - local quality = options.quality > 0 and "[height<=?" .. options.quality .. "]" or "" - local codec = codec_list[options.codec:lower()] or "" - local fallback = options.fallback and " / " .. options.fallback_format or "" - local ytdl_custom = "bv" .. quality .. codec .. "+ba/b" .. quality .. fallback + + local format = { + quality = options.quality > 0 and "[height<=?" .. options.quality .. "]" or "", + codec = codec_list[options.codec:lower()] or "", + fallback = options.fallback and " / " .. options.fallback_format or "", + } + + local ytdl_custom = "bv" .. format.quality .. format.codec .. "+ba/b" .. format.quality .. format.fallback + mp.set_property("file-local-options/ytdl-format", ytdl_custom) msg.info("Changed ytdl-format to: " .. ytdl_custom) end