diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2012-05-03 08:52:57 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2012-05-03 08:52:57 +0000 |
commit | 929046cef4fba399f3bfdca62eba78444a6005ce (patch) | |
tree | 05c20da45aa524a67a66a2feef585cc572bb09d0 /applications/luci-minidlna/luasrc/controller | |
parent | 62ec28f0be1b951342e5770c80c4bc0bb7182622 (diff) |
applications/luci-minidlna: fix status parsing
Diffstat (limited to 'applications/luci-minidlna/luasrc/controller')
-rw-r--r-- | applications/luci-minidlna/luasrc/controller/minidlna.lua | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/applications/luci-minidlna/luasrc/controller/minidlna.lua b/applications/luci-minidlna/luasrc/controller/minidlna.lua index 5b9d62ef1..1bd5617f6 100644 --- a/applications/luci-minidlna/luasrc/controller/minidlna.lua +++ b/applications/luci-minidlna/luasrc/controller/minidlna.lua @@ -43,14 +43,12 @@ function minidlna_status() if status.running then local fd = sys.httpget("http://127.0.0.1:%d/" % (port or 8200), true) if fd then - local ln - repeat - ln = fd:read("*l") - if ln and ln:match("files:") then - local ftype, fcount = ln:match("(.+) files: (%d+)") - status[ftype:lower()] = tonumber(fcount) or 0 - end - until not ln + local html = fd:read("*a") + if html then + status.audio = (tonumber(html:match("Audio files: (%d+)")) or 0) + status.video = (tonumber(html:match("Video files: (%d+)")) or 0) + status.image = (tonumber(html:match("Image files: (%d+)")) or 0) + end fd:close() end end |