This commit is contained in:
ClF3 2024-01-24 01:09:25 +08:00
parent 2d11336736
commit 2a80c87d22
1 changed files with 21 additions and 18 deletions

39
main.py
View File

@ -3,11 +3,14 @@ import numpy as np
import urllib.request import urllib.request
from datetime import datetime from datetime import datetime
import time import time
recent=[] recent_blog=[]
recent_cloud=[]
recent_code=[]
recent_git=[]
blog=[] blog=[]
git=[]
cloud=[] cloud=[]
code=[] code=[]
git=[]
width=720 width=720
height=50 height=50
red=(0x00,0x00,0xff) red=(0x00,0x00,0xff)
@ -69,13 +72,13 @@ if __name__=="__main__":
print("connected",delay,"ms") print("connected",delay,"ms")
else: else:
print("error") print("error")
if len(recent)<10: if len(recent_blog)<10:
recent.append(delay) recent_blog.append(delay)
else: else:
update_history(blog) update_history(blog)
update_graph("blog.png",blog) update_graph("blog.png",blog)
recent=[] recent_blog=[]
recent.append(delay) recent_blog.append(delay)
elif datetime.now().second==10 and datetime.now().minute!=lastminute: elif datetime.now().second==10 and datetime.now().minute!=lastminute:
# if True: # if True:
@ -86,13 +89,13 @@ if __name__=="__main__":
print("connected",delay,"ms") print("connected",delay,"ms")
else: else:
print("error") print("error")
if len(recent)<10: if len(recent_cloud)<10:
recent.append(delay) recent_cloud.append(delay)
else: else:
update_history(cloud) update_history(cloud)
update_graph("cloud.png",cloud) update_graph("cloud.png",cloud)
recent=[] recent_cloud=[]
recent.append(delay) recent_cloud.append(delay)
elif datetime.now().second==20 and datetime.now().minute!=lastminute: elif datetime.now().second==20 and datetime.now().minute!=lastminute:
# if True: # if True:
@ -103,13 +106,13 @@ if __name__=="__main__":
print("connected",delay,"ms") print("connected",delay,"ms")
else: else:
print("error") print("error")
if len(recent)<10: if len(recent_code)<10:
recent.append(delay) recent_code.append(delay)
else: else:
update_history(code) update_history(code)
update_graph("code.png",code) update_graph("code.png",code)
recent=[] recent_code=[]
recent.append(delay) recent_code.append(delay)
elif datetime.now().second==30 and datetime.now().minute!=lastminute: elif datetime.now().second==30 and datetime.now().minute!=lastminute:
# if True: # if True:
@ -120,10 +123,10 @@ if __name__=="__main__":
print("connected",delay,"ms") print("connected",delay,"ms")
else: else:
print("error") print("error")
if len(recent)<10: if len(recent_git)<10:
recent.append(delay) recent_git.append(delay)
else: else:
update_history(git) update_history(git)
update_graph("git.png",git) update_graph("git.png",git)
recent=[] recent_git=[]
recent.append(delay) recent_git.append(delay)