mirror of
https://github.com/mpv-player/mpv
synced 2024-12-25 16:33:02 +00:00
ytdl_hook: be more informative when youtube-dl fails
This commit is contained in:
parent
48143b0cf5
commit
2d6fdccb92
@ -366,9 +366,15 @@ mp.add_hook(o.try_ytdl_first and "on_load" or "on_load_fail", 10, function ()
|
||||
local es, json, result = exec(command)
|
||||
|
||||
if (es < 0) or (json == nil) or (json == "") then
|
||||
if not result.killed_by_us then
|
||||
msg.error("youtube-dl failed")
|
||||
local err = "youtube-dl failed: "
|
||||
if result.error and result.error == "init" then
|
||||
err = err .. "not found or not enough permissions"
|
||||
elseif not result.killed_by_us then
|
||||
err = err .. "unexpected error ocurred"
|
||||
else
|
||||
err = string.format("%s returned '%d'", err, es)
|
||||
end
|
||||
msg.error(err)
|
||||
return
|
||||
end
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user