This commit is contained in:
M. A. Reza 2026-01-01 15:45:36 +03:30
parent 33dc2333c4
commit 3627baa228
3 changed files with 13 additions and 4 deletions

13
test_sound.py Normal file
View File

@ -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

Binary file not shown.

View File

@ -22,7 +22,3 @@ def play_alarm_sound(file_path, volume):
capture_output=True, capture_output=True,
) )
subprocess.run(["paplay", file_path], capture_output=True) subprocess.run(["paplay", file_path], capture_output=True)
if __name__ == "__main__":
play_alarm_sound(**SOUNDS["alarm"])