Split-out and refactor 'pactl list sinks' parser
[khatus.git] / bin / khatus_controller
index d9218ce..c2e5d91 100755 (executable)
@@ -95,8 +95,7 @@
 
 /^in:VOLUME/\
 {
-    shift()
-    db["volume"] = $0
+    set_volume()
 }
 
 /^in:MPD_SONG OK +MPD/ { delete db_mpd_song; next }
     output_msg_status_bar(make_status_bar())
 }
 
+function set_volume(    mute, left, right) {
+    # 0 RUNNING no 75% 75%
+    #msg_head = $1
+    #sink     = $2
+    #state    = $3
+    mute      = $4
+    left      = $5
+    right     = $6
+
+    if (mute == "no") {
+        db["volume"] = sprintf("%s %s", left, right)
+    } else if (mute == "yes") {
+        db["volume"] = "X"
+    } else {
+        # TODO: Log error - unexpected mute value
+    }
+}
+
 function set_mpd_song(    key, val) {
     key = $2
     shift()
This page took 0.024381 seconds and 4 git commands to generate.