29 lines
725 B
Python
Executable File
29 lines
725 B
Python
Executable File
#!/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)
|