6a2a4a19ee95b31820c29cfec2b4cef02acadab5
[khatus.git] / src / awk / exe / parse_pactl_list_sinks.awk
1 /^Sink \#[0-9]+$/ {
2 sub("^#", "", $2)
3 sink = $2
4 next
5 }
6
7 /\tState:/ {
8 state[sink] = $2
9 next
10 }
11
12 /\tMute:/ {
13 mute[sink] = $2
14 next
15 }
16
17 # Volume: front-left: 45732 / 70% / -9.38 dB, front-right: 45732 / 70% / -9.38 dB
18 /\tVolume:/ {
19 delete vol_parts
20 delete left_parts
21 delete right_parts
22 sub("^\t+Volume: +", "")
23 split($0, vol_parts, ", +")
24 sub("^front-left: +", "", vol_parts[1])
25 sub("^front-right: +", "", vol_parts[2])
26 split(vol_parts[1], left_parts, " +/ +")
27 split(vol_parts[2], right_parts, " +/ +")
28 vol_left[sink] = left_parts[2]
29 vol_right[sink] = right_parts[2]
30 next
31 }
32
33 END {
34 for (sink in state) {
35 print("state" Kfs sink, state[sink])
36 print("mute" Kfs sink, mute[sink])
37 print("vol_left" Kfs sink, vol_left[sink])
38 print("vol_right" Kfs sink, vol_right[sink])
39 }
40 }
This page took 0.047747 seconds and 3 git commands to generate.