Skip to content

Commit

Permalink
ytdl_hook: be more informative when youtube-dl fails
Browse files Browse the repository at this point in the history
  • Loading branch information
wiiaboo committed Jan 12, 2018
1 parent 48143b0 commit 2d6fdcc
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions player/lua/ytdl_hook.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2d6fdcc

Please sign in to comment.