-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHealthyProgrammer.py
More file actions
51 lines (41 loc) · 1.42 KB
/
HealthyProgrammer.py
File metadata and controls
51 lines (41 loc) · 1.42 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
47
48
49
50
51
# HEALTHY PROGRAMMER
from pygame import mixer
from datetime import datetime
from time import time
def musicloop(file, stopper):
mixer.init()
mixer.music.load(file)
mixer.music.play()
while True:
a = input()
if a==stopper:
mixer.music.stop()
break
def log_now(msg):
with open("log.txt", "a") as f:
f.write(f"{msg} {datetime.now()}\n\n")
if __name__ == '__main__':
init_water = time()
init_eyes = time()
init_physical = time()
watersecs = 30*60
eyessecs= 25*60
physecs= 60*60
while True:
if time()- init_water > watersecs:
print("Time to Drink water. Enter Y if already drank.\n")
musicloop("water.mp3", "Y")
init_water = time()
log_now("Drank water at")
if time()- init_eyes > eyessecs:
print("Time to do eye exercise. Enter Y if already done.\n")
musicloop("eyes (online-audio-converter.com).mp3", "Y")
init_eyes = time()
log_now("Done eye exercise at")
if time()- init_physical > physecs:
print("Time to do physical exercise. Enter Y if already done.\n")
musicloop("physical (online-audio-converter.com).mp3", "Y")
init_physical = time()
log_now("Done physical exercise at")
if input()== "quit":
break