-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdevelopment_lin.py
More file actions
27 lines (21 loc) · 1.01 KB
/
development_lin.py
File metadata and controls
27 lines (21 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import os
import time
import re
#.replace("\t", "").replace(" ", "").replace("index:", "").replace("[!0-9]", "")
devices = os.popen("pacmd list-sinks | grep index:").read()
devices = re.sub(r"[^(0-9\n)]", "", devices)
devices = devices.split("\n")[0:-1]
def to_volume_value(value):
return hex(int(0x10000/100*value))
for i in devices:
os.system('pacmd set-default-sink {}'.format(i))
# current volume is
volume = os.popen("amixer -c 1 -M -D pulse get Master | grep -m 1 -o -E [[:digit:]]+% | tr -d '%'").read()
print("Volume is {}".format(volume))
os.system("pacmd set-sink-volume {}".format(to_volume_value(50)))
volume = os.popen("amixer -c 1 -M -D pulse get Master | grep -m 1 -o -E [[:digit:]]+% | tr -d '%'").read()
print("Volume is {}".format(volume))
# maybe change volume to 50 then 100 percent?
time.sleep(3)
volume = os.popen("amixer -c 1 -M -D pulse get Master | grep -m 1 -o -E [[:digit:]]+% | tr -d '%'").read()
print("Volume is {}".format(volume))