hddtemp: minor style changes

This commit is contained in:
Adrian C. (anrxc) 2010-03-13 03:39:54 +01:00
parent 9338cb930b
commit febc91dda5
2 changed files with 8 additions and 13 deletions

View File

@ -21,13 +21,12 @@ local function worker(format, port)
if port == nil then port = 7634 end
-- Get info from the hddtemp daemon
local f = io.popen("curl --connect-timeout 1 -fsm 3 telnet://127.0.0.1:" .. port)
local f = io.popen("curl --connect-timeout 1 -fsm 3 telnet://127.0.0.1:"..port)
local hdd_temp = {}
for line in f:lines() do
for disk, temp in string.gmatch(line, "|([%/%a%d]+)|.-|([%d]+)|[CF]+|")
do
hdd_temp["{"..disk.."}"] = tonumber(temp)
for d, t in string.gmatch(line, "|([%/%a%d]+)|.-|([%d]+)|[CF]+|") do
hdd_temp["{"..d.."}"] = tonumber(t)
end
end
f:close()

14
org.lua
View File

@ -40,16 +40,12 @@ local function worker(format, warg)
local b, e, y, m, d = string.find(line, "(%d%d%d%d)-(%d%d)-(%d%d)")
if b then
local t = os.time{ year = y, month = m, day = d }
local t = os.time{ year = y, month = m, day = d }
if t < today then
count.past = count.past + 1
elseif t == today then
count.today = count.today + 1
elseif t <= soon then
count.soon = count.soon + 1
elseif t <= future then
count.future = count.future + 1
if t < today then count.past = count.past + 1
elseif t == today then count.today = count.today + 1
elseif t <= soon then count.soon = count.soon + 1
elseif t <= future then count.future = count.future + 1
end
end
end