-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathtimedpomodoro.py
76 lines (67 loc) · 2.5 KB
/
timedpomodoro.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
# Designed for when you have 8+ hours straight to work.
# TODO: Make this play the mp3 file included in the folder.
# http://stackoverflow.com/questions/307305/play-a-sound-with-python
import sys
from pygame_sound import * # TODO: include this when on Linux computer
sys.dont_write_bytecode = True
from Pomodoro import *
import time
def clear_screen():
for i in range(0, 100):
print("")
# TODO: comment or uncomment print \a vs playSound
# takes amount in seconds, session is a Pomodoro instance
def time_remaining(amount, session, globaltimer):
orig_amount = amount
while amount != 0:
clear_screen()
session.printProgress()
if (orig_amount == session.get_breaktime() or orig_amount == session.get_longbreak()):
for i in range(0,10):
print("ON BREAK ON BREAK ON BREAK ON BREAK ON BREAK ON BREAK")
print("\nBreak timer: %d minutes and %d seconds remaining. ON BREAK!!!" % ((amount / 60), (amount % 60)))
else:
print("\nPomodoro timer: %d minutes and %d seconds remaining." % ((amount / 60), (amount % 60)))
amount = amount - 1
if (globaltimer != None):
if globaltimer.done():
break
globaltimer.status()
globaltimer.decrement()
time.sleep(1)
def execute_pomodoro(session, globaltimer):
while session.done() == False:
time_remaining(session.get_pomodoro(), session, globaltimer)
if (globaltimer != None):
if globaltimer.done():
globaltimer.status()
break
playSound("./sounds/harp.mp3")
#print "\a"
session.add()
if session.done():
session.printProgress()
break
if ((session.get_number_pomo() % session.dividend) == 0):
time_remaining(session.get_longbreak(), session, globaltimer)
else:
time_remaining(session.get_breaktime(), session, globaltimer)
if (globaltimer != None):
if globaltimer.done():
globaltimer.status()
break
playSound("./sounds/exclamation.mp3")
#print "\a"
session.printProgress()
playSound("./sounds/exclamation.mp3")
#print "\a"
print("\nExiting.")
print("DONE! ctrl + c to exit")
playSound("./sounds/abadis.mp3")
def main():
# 27 minutes and 30 seconds = 1650 seconds
session = Pomodoro()
session.printProgress()
execute_pomodoro(session, None)
if __name__ == "__main__":
main()