Revert "[module/pulseaudio] somewhat experimental immediate update"

This reverts commit d5d0d6a56c.
This commit is contained in:
tobi-wan-kenobi 2022-08-30 21:50:56 +02:00
parent d5d0d6a56c
commit b1fd18b9af

View file

@ -33,17 +33,12 @@ Requires the following executable:
""" """
import re import re
import os
import logging import logging
import functools import functools
import threading
import subprocess
import select
import core.module import core.module
import core.widget import core.widget
import core.input import core.input
import core.event
import util.cli import util.cli
import util.graph import util.graph
@ -108,42 +103,6 @@ class Module(core.module.Module):
for event in events: for event in events:
core.input.register(self, button=event["button"], cmd=event["action"]) core.input.register(self, button=event["button"], cmd=event["action"])
self.__monitor = threading.Thread(target=self.__subscribe, args=())
self.__monitor.start()
def __subscribe(self):
self.update2()
core.event.trigger("update", [self.id], redraw_only=True)
core.event.trigger("draw")
try:
proc = subprocess.Popen("pactl subscribe",
stdout = subprocess.PIPE,
stderr = subprocess.PIPE,
shell = True
)
except:
return
os.set_blocking(proc.stdout.fileno(), False)
while threading.main_thread().is_alive():
r, w, e = select.select([proc.stdout], [], [], 1)
if not (r or w or e):
continue # timeout
line = 'test'
update = False
while line:
line = proc.stdout.readline().decode("ascii", errors="ignore")
if "client" in line:
update = True
if update:
self.update2()
core.event.trigger("update", [self.id], redraw_only=True)
core.event.trigger("draw")
while proc.stdout.readline().decode("ascii", errors="ignore"):
pass
def set_volume(self, amount): def set_volume(self, amount):
util.cli.execute( util.cli.execute(
"pactl set-{}-{} @DEFAULT_{}@ {}".format( "pactl set-{}-{} @DEFAULT_{}@ {}".format(
@ -241,11 +200,6 @@ class Module(core.module.Module):
return output return output
def update(self): def update(self):
if self.__monitor.is_alive():
return
self.update2()
def update2(self):
try: try:
self._failed = False self._failed = False
channel = "sinks" if self._channel == "sink" else "sources" channel = "sinks" if self._channel == "sink" else "sources"