-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhelthy programmer.py
More file actions
52 lines (44 loc) · 1.6 KB
/
helthy programmer.py
File metadata and controls
52 lines (44 loc) · 1.6 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
52
#=======================HEALTHY PROGRAMMER===========================
# 9 am to 5 pm
# water=water.mp3 (3.5 liters) drank very 40 min
# eyes=eyes.mp3 (evry 30 min) eydone
# physical activity=physical.mp3 (every 45 min) exdone
from datetime import datetime
from pygame import mixer
from time import time
def musiconloop(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("mylogs.txt","a") as f :
f.write(f"{msg}{datetime.now()}\n")
if __name__ == '__main__':
# musiconloop("paani.mp3.mp3" ,"done")
init_water=time()
init_eyes=time()
init_excercise=time()
watersecs=2400
eyesec=1800
excsecs =2700
while True:
if time()- init_water>watersecs:
print("Water drinking time...... enter 'drank' to stop the alarm......\n")
musiconloop('paani.mp3.mp3','drank')
init_water=time()
log_now("drank water at\t")
if time() - init_eyes > eyesec:
print("eye excrcise time...... enter 'done' to stop the alarm......\n")
musiconloop('paani.mp3.mp3', 'done')
init_eyes = time()
log_now("eyes relaxed at\t")
if time() - init_excercise > excsecs:
print("excercising time...... enter 'doneex' to stop the alarm......\n")
musiconloop('paani.mp3.mp3', 'doneex')
init_excercise = time()
log_now("done excercise at\t")