diff --git a/system/hardware/pc/hardware.py b/system/hardware/pc/hardware.py index d6a27f8d5e..0c83ff267b 100644 --- a/system/hardware/pc/hardware.py +++ b/system/hardware/pc/hardware.py @@ -1,5 +1,4 @@ import random -import time import pulsectl @@ -24,11 +23,7 @@ class Pc(HardwareBase): return True def is_sound_playing(self): - start_time = time.time() - result = any(s.state == 'RUNNING' for s in self.pulse.sink_input_list()) - duration = time.time() - start_time - print(f"is_sound_playing took {duration:.2f}s") - return result + return len(self.pulse.sink_input_list()) > 0 def reboot(self, reason=None): print("REBOOT!") diff --git a/system/hardware/tici/hardware.py b/system/hardware/tici/hardware.py index 93410752b5..dee0c3bd05 100644 --- a/system/hardware/tici/hardware.py +++ b/system/hardware/tici/hardware.py @@ -102,11 +102,7 @@ class Tici(HardwareBase): open('/proc/asound/card0/state').read().strip() == 'ONLINE') def is_sound_playing(self): - start_time = time.time() - result = any(s.state == 'RUNNING' for s in self.pulse.sink_input_list()) - duration = time.time() - start_time - print(f"is_sound_playing took {duration:.2f}s") - return result + return len(self.pulse.sink_input_list()) > 0 def reboot(self, reason=None): subprocess.check_output(["sudo", "reboot"])