From a2db7792b7ee8d0972b55e0fd371627891997b92 Mon Sep 17 00:00:00 2001 From: Fabio <1833932-open-dynaMIX@users.noreply.github.com> Date: Sun, 9 Jun 2019 20:28:47 +0200 Subject: [PATCH] Log a warning if a property could not be fetched from mpv. --- webui.lua | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/webui.lua b/webui.lua index 609a4410..5373e130 100644 --- a/webui.lua +++ b/webui.lua @@ -263,12 +263,20 @@ local function build_status_response() -- We need to check if the value is available. -- If the file just started playing, mp-functions return nil for a short time. - for _, v in pairs(values) do + + fail = false + for k, v in pairs(values) do if v == '' then - return false + mp.msg.log("WARN", 'Could not fetch "'.. k .. '" from mpv.') + fail = true end end + if fail then + mp.msg.log("WARN", 'This is normal during startup.') + return false + end + return '{"audio-delay":'..values['audio_delay']:sub(1, -4)..',' .. '"duration":'..round(values['duration'])..',' .. '"filename":"'..values['filename']..'",' ..