Revert "Merge branch '917-event-based-pulseaudio'"
This reverts commit72a888748e
, reversing changes made tod57ef9364a
. This merge causes really high CPU load if using both pasink and pasource, because those two modules trigger each other, and there's not a terrible lot I can do about that, unfortunately.
This commit is contained in:
parent
72a888748e
commit
28601cf2b7
3 changed files with 9 additions and 59 deletions
|
@ -33,18 +33,12 @@ Requires the following executable:
|
|||
"""
|
||||
|
||||
import re
|
||||
import os
|
||||
import time
|
||||
import logging
|
||||
import functools
|
||||
import threading
|
||||
import subprocess
|
||||
import select
|
||||
|
||||
import core.module
|
||||
import core.widget
|
||||
import core.input
|
||||
import core.event
|
||||
|
||||
import util.cli
|
||||
import util.graph
|
||||
|
@ -109,36 +103,6 @@ class Module(core.module.Module):
|
|||
for event in events:
|
||||
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)
|
||||
try:
|
||||
proc = subprocess.Popen("pactl subscribe",
|
||||
stdout = subprocess.PIPE,
|
||||
stderr = subprocess.STDOUT,
|
||||
shell = True
|
||||
)
|
||||
except:
|
||||
return
|
||||
while threading.main_thread().is_alive():
|
||||
r, w, e = select.select([proc.stdout], [], [], 1)
|
||||
|
||||
if not (r or w or e):
|
||||
self.update2()
|
||||
core.event.trigger("update", [self.id], redraw_only=True)
|
||||
core.event.trigger("draw")
|
||||
continue # timeout
|
||||
# whateve we got, use it
|
||||
self.update2()
|
||||
core.event.trigger("update", [self.id], redraw_only=True)
|
||||
core.event.trigger("draw")
|
||||
os.set_blocking(proc.stdout.fileno(), False)
|
||||
proc.stdout.read()
|
||||
os.set_blocking(proc.stdout.fileno(), True)
|
||||
|
||||
def set_volume(self, amount):
|
||||
util.cli.execute(
|
||||
"pactl set-{}-{} @DEFAULT_{}@ {}".format(
|
||||
|
@ -236,11 +200,6 @@ class Module(core.module.Module):
|
|||
return output
|
||||
|
||||
def update(self):
|
||||
if self.__monitor.is_alive():
|
||||
return
|
||||
self.update2()
|
||||
|
||||
def update2(self):
|
||||
try:
|
||||
self._failed = False
|
||||
channel = "sinks" if self._channel == "sink" else "sources"
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue