Update sound_utils.py
This commit is contained in:
parent
e7320da31c
commit
33dc2333c4
@ -1,13 +1,15 @@
|
||||
import subprocess
|
||||
|
||||
|
||||
def play_alarm_sound():
|
||||
subprocess.run(
|
||||
["paplay", "/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga"]
|
||||
)
|
||||
SOUNDS = {
|
||||
"alarm": {
|
||||
"file_path": "/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga",
|
||||
"volume": "50%",
|
||||
},
|
||||
"notif": {"file_path": "utils/assets/error-08-206492.mp3", "volume": "85%"},
|
||||
}
|
||||
|
||||
|
||||
def play_alarm_sound2():
|
||||
def play_alarm_sound(file_path, volume):
|
||||
subprocess.run(
|
||||
[
|
||||
"amixer",
|
||||
@ -15,13 +17,12 @@ def play_alarm_sound2():
|
||||
"pulse",
|
||||
"sset",
|
||||
"Master",
|
||||
"50%",
|
||||
]
|
||||
)
|
||||
subprocess.run(
|
||||
["paplay", "/usr/share/sounds/freedesktop/stereo/alarm-clock-elapsed.oga"]
|
||||
volume,
|
||||
],
|
||||
capture_output=True,
|
||||
)
|
||||
subprocess.run(["paplay", file_path], capture_output=True)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
play_alarm_sound2()
|
||||
play_alarm_sound(**SOUNDS["alarm"])
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user