Skip to content

Commit

Permalink
Log a warning if a property could not be fetched from mpv.
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabio authored and open-dynaMIX committed Jun 9, 2019
1 parent 9d5e65a commit 0d42e81
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions webui.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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']..'",' ..
Expand Down

0 comments on commit 0d42e81

Please sign in to comment.