update
This commit is contained in:
parent
37b8bd60a1
commit
6b33b67e5b
16
.vscode/launch.json
vendored
Normal file
16
.vscode/launch.json
vendored
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
// Use IntelliSense to learn about possible attributes.
|
||||||
|
// Hover to view descriptions of existing attributes.
|
||||||
|
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
||||||
|
"version": "0.2.0",
|
||||||
|
"configurations": [
|
||||||
|
|
||||||
|
{
|
||||||
|
"name": "Python Debugger: Current File",
|
||||||
|
"type": "debugpy",
|
||||||
|
"request": "launch",
|
||||||
|
"program": "${file}",
|
||||||
|
"console": "integratedTerminal"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
@ -3,9 +3,10 @@ import subprocess
|
|||||||
SOUNDS = {
|
SOUNDS = {
|
||||||
"alarm": {
|
"alarm": {
|
||||||
"file_path": "/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga",
|
"file_path": "/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga",
|
||||||
"volume": "50%",
|
"volume": "35%",
|
||||||
},
|
},
|
||||||
"notif": {"file_path": "utils/assets/error-08-206492.mp3", "volume": "85%"},
|
"notif": {"file_path": "utils/assets/error-08-206492.mp3", "volume": "45%"},
|
||||||
|
"success": {"file_path": "/usr/share/sounds/freedesktop/stereo/message.oga", "volume": "40%"}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -22,3 +23,17 @@ 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__':
|
||||||
|
import subprocess
|
||||||
|
from datetime import datetime, time
|
||||||
|
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["success"])
|
||||||
|
do_alarm_later = False
|
||||||
|
else:
|
||||||
|
print("*** It's namaz time so we'll play alarm sound later")
|
||||||
|
do_alarm_later = True
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user