From 2d6fdccb9230f3486573bb6cec85e1fbfb000ca1 Mon Sep 17 00:00:00 2001 From: Ricardo Constantino Date: Fri, 12 Jan 2018 01:38:30 +0000 Subject: ytdl_hook: be more informative when youtube-dl fails --- player/lua/ytdl_hook.lua | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/player/lua/ytdl_hook.lua b/player/lua/ytdl_hook.lua index cc060cdcb8..5416a7ff07 100644 --- a/player/lua/ytdl_hook.lua +++ b/player/lua/ytdl_hook.lua @@ -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 -- cgit v1.2.3