Skip to content

Instantly share code, notes, and snippets.

@akarsh1995
Created September 6, 2020 16:26
Show Gist options
  • Select an option

  • Save akarsh1995/34175538c43240eb7fc68ab05a5a91ae to your computer and use it in GitHub Desktop.

Select an option

Save akarsh1995/34175538c43240eb7fc68ab05a5a91ae to your computer and use it in GitHub Desktop.
Working for long hours πŸ–₯️ ? Use our script to remind you to take breaks every 30 minutes πŸ˜‡ !
playsound==1.2.2
gTTS==2.1.1
from pathlib import Path
from playsound import playsound
from gtts import gTTS
import time
break_duration = 30 # in minutes
launch_text = (
"Hi there!, We will remind you to take break every"
+ str(break_duration)
+ "minutes. Starting Timer Now."
)
break_text = "Hi, You can take a short break now!"
if not Path('first.mp3').exists():
tts = gTTS(text=launch_text, lang="en")
save = "first.mp3"
tts.save(save)
tts = gTTS(text=break_text, lang="en")
save = "break.mp3"
tts.save(save)
if __name__ == '__main__':
try:
count = 0
while True:
if count == 0:
playsound("first.mp3")
else:
playsound("break.mp3")
count = count + 1
time.sleep(60 * break_duration)
except KeyboardInterrupt:
print('Keep Coming.')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment