From a02f3a5dd45cb946c6b7e75c5b5349c6c4e5fdc8 Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Fri, 23 Oct 2015 17:22:54 +0100 Subject: 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. --- player/lua/ytdl_hook.lua | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'player') 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) -- cgit v1.2.3