Skip to content

Commit

Permalink
refactor: group format params together
Browse files Browse the repository at this point in the history
  • Loading branch information
Samillion authored Nov 3, 2024
1 parent d24a6b7 commit 99c55cf
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions ytdlautoformat.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 99c55cf

Please sign in to comment.