Skip to content
Snippets Groups Projects
Commit a46b45bd authored by Marvin Feiter's avatar Marvin Feiter
Browse files

throw some python at volumecontrol as well

parent e730c4f5
No related branches found
No related tags found
No related merge requests found
import sys, re
if len(sys.argv)!=2:
exit()
pactl_input = ""
for line in sys.stdin:
pactl_input += line
sink_name = sys.argv[1]
sink_id = ""
sinks = pactl_input.split("\n\n")
try: # sink is given b index
int(sink_name)
sink_id = sink_name
except: # sink is given by name
for sink in sinks:
if "Name: "+sink_name in sink:
sink_id = sink.split("\n")[0].split("#")[-1]
#
for sink in sinks:
if "Sink #"+sink_id in sink:
for line in sink.split("\n"):
if re.search(r"^Volume:", line.strip()):
print(re.findall("[0-9]{1,3}%",line)[0])
\ No newline at end of file
...@@ -59,8 +59,8 @@ handle_volume () { ...@@ -59,8 +59,8 @@ handle_volume () {
else else
pctl set-sink-volume "$sink" "$cmd" pctl set-sink-volume "$sink" "$cmd"
fi fi
current_volume=$(PULSE_SERVER=$host pactl list | python $SCRIPTPATH/get-sink-volume.py $sink)
current_volume=$(pctl list sinks | grep -A 12 "$sink" | grep "Base Volume" | awk '{split($0,a," / "); print a[2]}') #hacky, aber die pulse version erlaubt grad nix anderes #current_volume=$(pctl list sinks | grep -A 12 "$sink" | grep "Base Volume" | awk '{split($0,a," / "); print a[2]}') #hacky, aber die pulse version erlaubt grad nix anderes
echo -n $room is now at $current_volume echo -n $room is now at $current_volume
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment