1
0
mirror of https://github.com/mpv-player/mpv synced 2025-02-07 23:51:49 +00:00

ytdl_hook: look for the right ytdl binary according to system

package.config is available in 5.1, 5.2, 5.3 and luajit, so should be fine.
The first character is the path separator, so it's '\' on windows and '/'
on *nix.

This should also prevent cases where users download the wrong binary.
This commit is contained in:
Ricardo Constantino 2018-01-12 18:17:37 +00:00
parent 2d6fdccb92
commit b478d2b1ce
No known key found for this signature in database
GPG Key ID: EFD16019AE4FF531

View File

@ -310,7 +310,8 @@ mp.add_hook(o.try_ytdl_first and "on_load" or "on_load_fail", 10, function ()
-- check for youtube-dl in mpv's config dir
if not (ytdl.searched) then
local ytdl_mcd = mp.find_config_file("youtube-dl")
local exesuf = (package.config:sub(1,1) == '\\') and '.exe' or ''
local ytdl_mcd = mp.find_config_file("youtube-dl" .. exesuf)
if not (ytdl_mcd == nil) then
msg.verbose("found youtube-dl at: " .. ytdl_mcd)
ytdl.path = ytdl_mcd