-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmonTimeExec.py
More file actions
executable file
·46 lines (41 loc) · 1.15 KB
/
monTimeExec.py
File metadata and controls
executable file
·46 lines (41 loc) · 1.15 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
import time
import datetime
from requests import post
import pytz
url = "http://owenserver.us.to:23654"
fmt = "%H:%M"
est = pytz.timezone("US/Eastern")
tf = open("bootTimes.txt", "a+")
tf.write("\n" + str(datetime.datetime.now()))
tf.close()
while True:
f = open("timeExec.txt", "r")
et = f.read()
f.close()
oldET = et
startI = 0
while "time~" in et[startI:]:
eHLI = et.find("[",startI)+1
eHHI = et.find(":", eHLI)
eH = int(et[eHLI:eHHI])
eMLI = eHHI+1
eMHI = et.find("]", eMLI)
eM = int(et[eMLI:eMHI])
tt = datetime.datetime.now().astimezone(est).strftime(fmt)
tH = int(tt[0:tt.find(":")])
tM = int(tt[tt.find(":")+1:])
eLI = eMHI+2
eHI = et.find("?", eLI)
if eH == tH and eM == tM:
com = et[eLI:eHI]
et = et[0:eHLI-6]+et[eHI+1:]
f = open("timeExec.txt", "w")
f.write(et)
f.close()
print(com)
print(et)
post(url = url, data = {"content":com})
else:
startI = eHI
print(eH, eM, tH, tM)
time.sleep(1)