summaryrefslogtreecommitdiffstats
path: root/player
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2018-01-07 15:56:55 +0000
committerRicardo Constantino <wiiaboo@gmail.com>2018-01-07 15:56:55 +0000
commit87d3af6f1960f875aa4dc7ad4ffa2ce329562c07 (patch)
tree9bce82b52b71192de2635ae1a4bbebe546f1bca8 /player
parent5103b5dc2cfeb6bc980139444e0fd0110f8d4111 (diff)
downloadmpv-87d3af6f1960f875aa4dc7ad4ffa2ce329562c07.tar.bz2
mpv-87d3af6f1960f875aa4dc7ad4ffa2ce329562c07.tar.xz
ytdl_hook: add script option to revert to trying youtube-dl first
Should only make a difference if most of the URLs you open need youtube-dl parsing.
Diffstat (limited to 'player')
-rw-r--r--player/lua/ytdl_hook.lua5
1 files changed, 3 insertions, 2 deletions
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 74095e8e57..ee7a4e37fd 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -3,7 +3,8 @@ local msg = require 'mp.msg'
local options = require 'mp.options'
local o = {
- exclude = ""
+ exclude = "",
+ try_ytdl_first = false
}
options.read_options(o)
@@ -301,7 +302,7 @@ local function add_single_video(json)
end
end
-mp.add_hook("on_load_fail", 10, function ()
+mp.add_hook(try_ytdl_first and "on_load" or "on_load_fail", 10, function ()
local url = mp.get_property("stream-open-filename")
local start_time = os.clock()
if (url:find("ytdl://") == 1) or