def writetldirs(handler):
mydirs=gettldirs(timelapsedir)
content=[]
for item in mydirs:
fcount = len([name for name in os.listdir(item) if os.path.isfile(os.path.join(item,name))])
totsize = helpers.bytes2human(sum(os.path.getsize(os.path.join(item,name)) for name in os.listdir(item) if os.path.isfile(os.path.join(item,name))))
if not fcount == 0:
thumbnail=sorted([ name for name in os.listdir(item) if os.path.isfile(os.path.join(item,name))])[-1]
else:
thumbnail="../../images/nocam.png"
info = {
"directory": item,
"count": fcount,
"size": totsize,
"thumbnail": thumbnail,
}
content.append(info)
handler.write(json.dumps({"info": content}))
#webserver------------------------------------------------------------------------------------------------------------
#WebsocketHandler HTML5 and other websocket capable clients
评论列表
文章目录