minor fixes

This commit is contained in:
Artwork1 2018-01-04 23:46:40 +01:00
parent d3a9e9affa
commit 1a38065a08
1 changed files with 16 additions and 15 deletions

View File

@ -79,9 +79,10 @@ if not os.path.exists(logfile):
f.write("{},{},{}".format(time.time(), 0,0))
# get last line of log file and update 'total use' using that.
last = tail("")
last = tail(logfile)
bits = last.split(",")
totalUse = bits[2]
totalUse = float(bits[2])
print "Total use:", totalUse
log = open(logfile, "a")
@ -111,7 +112,7 @@ while True:
#~ lcd.message("viewers {:>8}\nview-min. {:>7.2f}".format(len(faces), totalUse/60))
lcd.message("{:>7} viewers \n{:>7}view-sec".format(len(faces), si_format(totalUse,precision=1)))
log.write("{},{},{}".format(time.time(), len(faces), int(totalUse)))
log.write("{},{},{}\n".format(time.time(), len(faces), int(totalUse)))
log.flush()
content = urllib2.urlopen("https://artstats.rubenvandeven.com/artwork1/views.php?time=%d&count=%d&total=%d" % (int(time.time()), len(faces), int(totalUse)) ).read()