ytdl: disable --all-subs if "sub-lang" is in raw-options

Defaults stay the same (--all-subs is used if sub-lang wasn't used.)
Don't forget to also add "write-sub=" if using sub-lang or else it won't
work.
This commit is contained in:
Ricardo Constantino 2015-10-23 17:22:54 +01:00 committed by wm4
parent 17b4fb02b3
commit a02f3a5dd4
1 changed files with 9 additions and 1 deletions

View File

@ -78,9 +78,10 @@ mp.add_hook("on_load", 10, function ()
local format = mp.get_property("options/ytdl-format")
local raw_options = mp.get_property_native("options/ytdl-raw-options")
local allsubs = true
local command = {
ytdl.path, "--no-warnings", "-J", "--flat-playlist", "--all-subs",
ytdl.path, "--no-warnings", "-J", "--flat-playlist",
"--sub-format", "ass/srt/best", "--no-playlist"
}
@ -103,6 +104,13 @@ mp.add_hook("on_load", 10, function ()
if (arg ~= "") then
table.insert(command, arg)
end
if (param == "sub-lang") and (arg ~= "") then
allsubs = false
end
end
if (allsubs == true) then
table.insert(command, "--all-subs")
end
table.insert(command, "--")
table.insert(command, url)