Show
Ignore:
Timestamp:
05/03/12 09:52:57 (13 months ago)
Author:
jow
Message:

applications/luci-minidlna: fix status parsing

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • luci/trunk/applications/luci-minidlna/luasrc/controller/minidlna.lua

    r8527 r8658  
    4444        local fd = sys.httpget("http://127.0.0.1:%d/" % (port or 8200), true) 
    4545        if fd then 
    46             local ln 
    47             repeat 
    48                 ln = fd:read("*l") 
    49                 if ln and ln:match("files:") then 
    50                     local ftype, fcount = ln:match("(.+) files: (%d+)") 
    51                     status[ftype:lower()] = tonumber(fcount) or 0 
    52                 end 
    53             until not ln 
     46            local html = fd:read("*a") 
     47            if html then 
     48                status.audio = (tonumber(html:match("Audio files: (%d+)")) or 0) 
     49                status.video = (tonumber(html:match("Video files: (%d+)")) or 0) 
     50                status.image = (tonumber(html:match("Image files: (%d+)")) or 0) 
     51            end 
    5452            fd:close() 
    5553        end