This commit is contained in:
ClF3 2024-01-24 01:21:32 +08:00
parent 2a80c87d22
commit 0aeb620679
1 changed files with 5 additions and 5 deletions

10
main.py
View File

@ -19,7 +19,7 @@ yellow=(0x00,0xcc,0xff)
light_green=(0x33,0xff,0xcc) light_green=(0x33,0xff,0xcc)
green=(0x00,0xcc,0x00) green=(0x00,0xcc,0x00)
imgpath="/tmp/uptime-graph/" imgpath="/tmp/uptime-graph/"
def update_history(history): def update_history(history,recent):
average=0 average=0
for i in recent: for i in recent:
average+=i average+=i
@ -75,7 +75,7 @@ if __name__=="__main__":
if len(recent_blog)<10: if len(recent_blog)<10:
recent_blog.append(delay) recent_blog.append(delay)
else: else:
update_history(blog) update_history(blog,recent_blog)
update_graph("blog.png",blog) update_graph("blog.png",blog)
recent_blog=[] recent_blog=[]
recent_blog.append(delay) recent_blog.append(delay)
@ -92,7 +92,7 @@ if __name__=="__main__":
if len(recent_cloud)<10: if len(recent_cloud)<10:
recent_cloud.append(delay) recent_cloud.append(delay)
else: else:
update_history(cloud) update_history(cloud,recent_cloud)
update_graph("cloud.png",cloud) update_graph("cloud.png",cloud)
recent_cloud=[] recent_cloud=[]
recent_cloud.append(delay) recent_cloud.append(delay)
@ -109,7 +109,7 @@ if __name__=="__main__":
if len(recent_code)<10: if len(recent_code)<10:
recent_code.append(delay) recent_code.append(delay)
else: else:
update_history(code) update_history(code,recent_code)
update_graph("code.png",code) update_graph("code.png",code)
recent_code=[] recent_code=[]
recent_code.append(delay) recent_code.append(delay)
@ -126,7 +126,7 @@ if __name__=="__main__":
if len(recent_git)<10: if len(recent_git)<10:
recent_git.append(delay) recent_git.append(delay)
else: else:
update_history(git) update_history(git,recent_git)
update_graph("git.png",git) update_graph("git.png",git)
recent_git=[] recent_git=[]
recent_git.append(delay) recent_git.append(delay)