summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRicardo Constantino <wiiaboo@gmail.com>2020-10-25 01:26:06 +0000
committerRicardo Constantino <wiiaboo@gmail.com>2020-10-27 15:42:39 +0000
commit93f84b514a741c2001e6603d0304cd4a6ab63c73 (patch)
tree6840d66fd12d955ef2d8703e5c4be758406eea4a
parentc07089a250121c48223f86e79b03af6886e6ece6 (diff)
downloadmpv-93f84b514a741c2001e6603d0304cd4a6ab63c73.tar.bz2
mpv-93f84b514a741c2001e6603d0304cd4a6ab63c73.tar.xz
ytdl_hook: support alternative youtube-dl path
Allows using a youtube-dl not in PATH or a compatible fork of youtube-dl.
-rw-r--r--DOCS/man/options.rst5
-rw-r--r--player/lua/ytdl_hook.lua6
2 files changed, 9 insertions, 2 deletions
diff --git a/DOCS/man/options.rst b/DOCS/man/options.rst
index 3d6f70ebfd..b25c1f8481 100644
--- a/DOCS/man/options.rst
+++ b/DOCS/man/options.rst
@@ -954,6 +954,11 @@ Program Behavior
if available, allowing for video/audio selection in runtime (default:
no). It's disabled ("no") by default for performance reasons.
+ ``ytdl_path=youtube-dl``
+ Configure path to youtube-dl executable or a compatible fork's.
+ The default "youtube-dl" looks for the executable in PATH. In a Windows
+ environment the suffix extension ".exe" is always appended.
+
.. admonition:: Why do the option names mix ``_`` and ``-``?
I have no idea.
diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua
index 929e379a89..afe284c9da 100644
--- a/player/lua/ytdl_hook.lua
+++ b/player/lua/ytdl_hook.lua
@@ -8,16 +8,18 @@ local o = {
use_manifests = false,
all_formats = false,
force_all_formats = true,
+ ytdl_path = "youtube-dl",
}
local ytdl = {
- path = "youtube-dl",
+ path = nil,
searched = false,
blacklisted = {}
}
options.read_options(o, nil, function()
ytdl.blacklisted = {} -- reparse o.exclude next time
+ ytdl.searched = false
end)
local chapter_list = {}
@@ -690,7 +692,7 @@ function run_ytdl_hook(url)
-- check for youtube-dl in mpv's config dir
if not (ytdl.searched) then
local exesuf = (package.config:sub(1,1) == '\\') and '.exe' or ''
- local ytdl_mcd = mp.find_config_file("youtube-dl" .. exesuf)
+ local ytdl_mcd = mp.find_config_file(o.ytdl_path .. exesuf)
if not (ytdl_mcd == nil) then
msg.verbose("found youtube-dl at: " .. ytdl_mcd)
ytdl.path = ytdl_mcd