aboutsummaryrefslogtreecommitdiff
path: root/inter.py
diff options
context:
space:
mode:
Diffstat (limited to 'inter.py')
-rw-r--r--inter.py23
1 files changed, 16 insertions, 7 deletions
diff --git a/inter.py b/inter.py
index 109950d..4a4cd5b 100644
--- a/inter.py
+++ b/inter.py
@@ -1,8 +1,17 @@
from collections import namedtuple
import pacmd
-Sink = namedtuple("Sink", ["name", "description", "index", "state", "muted"])
-SinkInput = namedtuple("SinkInput", ["name", "driver", "sink"])
+Sink = namedtuple("Sink",
+ ["name", # string
+ "description", # string
+ "index", # int
+ "state", # string
+ "muted", # bool
+ "volume"]) # string
+SinkInput = namedtuple("SinkInput",
+ ["name", # string
+ "driver", # string
+ "sink"]) # int
def list_sinks():
res = pacmd.list_sinks()
@@ -12,17 +21,17 @@ def list_sinks():
ret = []
for item in res.sections[0].items:
muted = item.children["muted"].value
- if type(muted) == str:
- if muted == "yes": muted = True
- elif muted == "no": muted = False
- else: assert False
+ if muted == "yes": muted = True
+ elif muted == "no": muted = False
+ else: assert False
sink = Sink(
item.children["name"].value,
item.children["properties"].children["device.description"].value,
item.index,
item.children["state"].value,
- muted)
+ muted,
+ item.children["volume"].value)
ret.append(sink)
return ret