aboutsummaryrefslogtreecommitdiffstats
path: root/DataBase/ExtraPro/Alarm.py
blob: d912df564cf705a1d72b9fcf47f80fded139be71 (plain) (blame)
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
import os
from playsound import playsound
import datetime

extracted_time = open('E:\\Zara\\Data.txt','rt')
time = extracted_time.read()
Time = str(time)

delete_time = open("E:\\Zara\\Data.txt",'r+')
delete_time.truncate(0)
delete_time.close()

def RingerNow(time):

    time_to_set = str(time)
    time_now = time_to_set.replace("zara","")
    time_now = time_now.replace("set alarm for ","")
    time_now = time_now.replace("set ","")
    time_now = time_now.replace("alarm ","")
    time_now = time_now.replace("for ","")
    time_now = time_now.replace(" and ",":")

    Alarm_Time = str(time_now)

    while True:

        current_time = datetime.datetime.now().strftime("%H:%M")

        if current_time == Alarm_Time:
            print("Wake Up Sir , It's Time To Work .")
            playsound("E:\\Zara\\DataBase\\Sounds\\1.mp3")

        elif current_time>Alarm_Time:
            break

RingerNow(Time)