Created
September 6, 2020 16:26
-
-
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 π !
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| playsound==1.2.2 | |
| gTTS==2.1.1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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