pull/26672/head
Cameron Clough 2 years ago
parent 0c1f3a4b86
commit baf9887e2d
No known key found for this signature in database
GPG Key ID: 48B6A0DB1DE6C320
  1. 7
      system/hardware/pc/hardware.py
  2. 6
      system/hardware/tici/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!")

@ -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"])

Loading…
Cancel
Save