1
0
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:
Ricardo Constantino 2018-01-12 01:38:30 +00:00
parent 48143b0cf5
commit 2d6fdccb92
No known key found for this signature in database
GPG Key ID: EFD16019AE4FF531

View File

@ -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