|
|
@ -102,11 +102,7 @@ class Tici(HardwareBase): |
|
|
|
open('/proc/asound/card0/state').read().strip() == 'ONLINE') |
|
|
|
open('/proc/asound/card0/state').read().strip() == 'ONLINE') |
|
|
|
|
|
|
|
|
|
|
|
def is_sound_playing(self): |
|
|
|
def is_sound_playing(self): |
|
|
|
start_time = time.time() |
|
|
|
return len(self.pulse.sink_input_list()) > 0 |
|
|
|
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 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def reboot(self, reason=None): |
|
|
|
def reboot(self, reason=None): |
|
|
|
subprocess.check_output(["sudo", "reboot"]) |
|
|
|
subprocess.check_output(["sudo", "reboot"]) |
|
|
|