Make a productivity notifier using python



Hey guys once again welcome to the Decoders blog, I hope you all are doing well and today I'm present with a productivity notifier ,which will basically notify you after a basic interval of time about your goals and plans for the day with the help of push notifications and repeating alarm. The given code will help you to built it, so just follow the codes and make your notifier easily, and enjoy it with your friends

from pygame import mixer
from plyer import notification
from time import time
print("welcome to healthify me........")

def notifyme(title, message):
notification.notify(
title=title,
message=message,
timeout=5,
app_icon="icon-location from your directory"
)
def musiconloop():
mixer.init()
mixer.music.load('audio file location')
mixer.music.play(loops=-1)

study_secs=100
coding_secs=200
study_time=time()
coding_time=time()
while True:
if time()-study_time>study_secs:
print("time for studying")
notifyme("study time", "its your studying time dude")
musiconloop()
n=input("press s to stop the alarm:")
if n=="s":
mixer.music.stop()
print("good job :)")
study_time=time()
else:
print("invalid input")
break
elif time()-coding_time>coding_secs:
print("time for coding")
notifyme("coding time", "its your coding time")
musiconloop()
n=input("press c to stop the alarm:")
if n=="c":
mixer.music.stop()
print("good job :)")
coding_time=time()
else:
print("invalid input")
break

Comments

Popular Posts