summaryrefslogtreecommitdiffstats
path: root/player/lua/ytdl_hook.lua
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2015-10-23 17:22:54 +0100
committerwm4 <wm4@nowhere>2015-10-24 17:30:22 +0200
commita02f3a5dd45cb946c6b7e75c5b5349c6c4e5fdc8 (patch)
tree24ed3fdd041cbaa2258a0cf8fadf76ef814d87db /player/lua/ytdl_hook.lua
parent17b4fb02b3b88113ee716a00f83a489321090709 (diff)
downloadmpv-a02f3a5dd45cb946c6b7e75c5b5349c6c4e5fdc8.tar.bz2
mpv-a02f3a5dd45cb946c6b7e75c5b5349c6c4e5fdc8.tar.xz
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.
Diffstat (limited to 'player/lua/ytdl_hook.lua')
-rw-r--r--player/lua/ytdl_hook.lua10
1 files changed, 9 insertions, 1 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 10c5a39b2b..010e90c582 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -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)