This commit is contained in:
Joe Ardent 2023-06-24 14:39:04 -07:00
commit 6895754dfe
3 changed files with 30 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/.venv

28
main.py Executable file
View file

@ -0,0 +1,28 @@
#!/home/ardent/virtualenvs/kroqnroll/bin/python3
from pulsectl import Pulse
import sys
with Pulse('kroq-volume') as pulse:
inputs = pulse.sink_input_list()
inputs = [input for input in inputs if "nrsc5" in input.name]
if len(inputs) < 1 or len(sys.argv) < 2:
sys.exit(0)
kroq = inputs[0]
vol = kroq.volume.value_flat
command = sys.argv[1].strip()
if command == "up":
vol = vol + 0.1
vol = min(vol, 1.0)
if command == "down":
vol = vol - 0.1
vol = max(vol, 0.0)
if command == "mute":
kroq.mute = not kroq.mute
kroq.volume.value_flat = vol
pulse.sink_input_mute(kroq.index, kroq.mute)
pulse.volume_set(kroq, kroq.volume)

1
requirements.txt Normal file
View file

@ -0,0 +1 @@
pulsectl==23.5.2