diff --git a/test_sound.py b/test_sound.py new file mode 100644 index 0000000..370e632 --- /dev/null +++ b/test_sound.py @@ -0,0 +1,13 @@ +import subprocess +from datetime import datetime, time +from utils.sound_utils import play_alarm_sound, SOUNDS +now = datetime.now().time() +namaz_zohr_time = time(12, 9) < now < time(13, 20) +namaz_maghrib_time = time(17, 24) < now < time(18, 45) +if not namaz_zohr_time and not namaz_maghrib_time: + print("*** PLAYED ALARM SOUND ***") + play_alarm_sound(**SOUNDS["notif"]) + do_alarm_later = False +else: + print("*** It's namaz time so we'll play alarm sound later") + do_alarm_later = True diff --git a/utils/assets/error-08-206492.mp3 b/utils/assets/error-08-206492.mp3 new file mode 100644 index 0000000..1b69267 Binary files /dev/null and b/utils/assets/error-08-206492.mp3 differ diff --git a/utils/sound_utils.py b/utils/sound_utils.py index dc677c5..f4cb57a 100644 --- a/utils/sound_utils.py +++ b/utils/sound_utils.py @@ -22,7 +22,3 @@ def play_alarm_sound(file_path, volume): capture_output=True, ) subprocess.run(["paplay", file_path], capture_output=True) - - -if __name__ == "__main__": - play_alarm_sound(**SOUNDS["alarm"])