applications/luci-minidlna: fix status parsing
This commit is contained in:
parent
62ec28f0be
commit
929046cef4
1 changed files with 6 additions and 8 deletions
|
@ -43,14 +43,12 @@ function minidlna_status()
|
||||||
if status.running then
|
if status.running then
|
||||||
local fd = sys.httpget("http://127.0.0.1:%d/" % (port or 8200), true)
|
local fd = sys.httpget("http://127.0.0.1:%d/" % (port or 8200), true)
|
||||||
if fd then
|
if fd then
|
||||||
local ln
|
local html = fd:read("*a")
|
||||||
repeat
|
if html then
|
||||||
ln = fd:read("*l")
|
status.audio = (tonumber(html:match("Audio files: (%d+)")) or 0)
|
||||||
if ln and ln:match("files:") then
|
status.video = (tonumber(html:match("Video files: (%d+)")) or 0)
|
||||||
local ftype, fcount = ln:match("(.+) files: (%d+)")
|
status.image = (tonumber(html:match("Image files: (%d+)")) or 0)
|
||||||
status[ftype:lower()] = tonumber(fcount) or 0
|
|
||||||
end
|
end
|
||||||
until not ln
|
|
||||||
fd:close()
|
fd:close()
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue