-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathPillTime.py
83 lines (75 loc) · 1.81 KB
/
PillTime.py
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#C:\Users\bsdueck\Dropbox\IFTTT
from pathlib import Path
import os
import time
import winsound
yes_file = Path("IFTTT\\yes.txt")
no_file = Path("IFTTT\\no.txt")
def checkfile():
#check if there is a yes file that exists
if yes_file.is_file():
time.sleep(1)
while True:
try:
os.remove(yes_file)
break
except:
pass
return 1
#check if there is a no file that exists
elif no_file.is_file():
time.sleep(1)
while True:
try:
os.remove(no_file)
break
except:
pass
return 2
#there is no file
else:
return 0
def TimeForYourPills():
winsound.PlaySound('wavfile\\TimeForYourPills.wav', winsound.SND_FILENAME)
start = time.clock()
time.sleep(30) #for now
winsound.PlaySound('wavfile\\HereAreYourPills.wav', winsound.SND_FILENAME)
start = time.clock()
while True:
time.sleep(5)
end = time.clock()
counter = 1
while True:
winsound.PlaySound('wavfile\\HaveYouTakenPills.wav', winsound.SND_FILENAME)
bool = noInput()
if bool == 3:
if (counter == 3):
winsound.PlaySound('wavfile\\NoPillNoChill.wav', winsound.SND_FILENAME)
exit()
counter += 1
bool = 0
if bool != 0:
if bool == 1:
winsound.PlaySound('wavfile\\AllClear.wav', winsound.SND_FILENAME)
return
elif bool == 2:
if (counter == 3):
winsound.PlaySound('wavfile\\NoPillNoChill.wav', winsound.SND_FILENAME)
exit()
winsound.PlaySound('wavfile\\Remind.wav', winsound.SND_FILENAME)
time.sleep(10)
counter += 1
def noInput():
start = time.clock()
while True:
end = time.clock()
bool = checkfile()
if ((end-start) > 20):
bool = 3
if bool != 0:
return bool
######################
##MAIN
######################
#need to check for file
TimeForYourPills();