Registrations with limited permissions are open. Reach out if you want to host your code here.
Browse Source

init commit

master
hejo 3 months ago
commit
286584a9e4
3 changed files with 70 additions and 0 deletions
  1. +29
    -0
      README.md
  2. +1
    -0
      countdown.txt
  3. +40
    -0
      pomo.py

+ 29
- 0
README.md View File

@ -0,0 +1,29 @@
# POMO.PY
Simple pomodoro timer for your cli. Currently only tested on Linux.
### Requirements
Python 3.6.+
## Usage
python3 pomo.py
*Times and text are currently hard coded - default 45/15*
#### Output
Work/ Break 44:05
## Function
- Simple pomodoro timer
- Time displayed in the terminal
- Time in 'countdown.txt' file (e.x. easy to add in obs)
## TODO
- [ ] Start option like...
- [ ] python3 pomo.py 45 15
- [ ] user input for the time

+ 1
- 0
countdown.txt View File

@ -0,0 +1 @@
0

+ 40
- 0
pomo.py View File

@ -0,0 +1,40 @@
#!/usr/bin/env python3
import os
import time
# Duration in minutes
work_time = 1
break_time = 1
# Duration in Seconds
work_time_sec = work_time * 60
break_time_sec = break_time * 60
def sec_to_min(sec):
full_min = int(sec / 60)
rest = sec - full_min * 60
output = str(full_min)+':'+str(rest).zfill(2)
return output
def timer(text,sec):
while sec > 0:
f = open('countdown.txt', 'w')
output = text + " " + sec_to_min(sec)
f.write(str(output))
f.close()
sec -= 1
time.sleep(1)
#os.system('cls' if os.name == 'nt' else 'clear')
print(chr(27) + "[2J") # only tested on Linux
print(output)
def main():
while True:
timer('Work',work_time_sec)
timer('Break',break_time_sec)
if __name__ == "__main__":
main()

Loading…
Cancel
Save