Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
incognitojam committed Dec 2, 2022
1 parent 0c1f3a4 commit baf9887
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 11 deletions.
7 changes: 1 addition & 6 deletions system/hardware/pc/hardware.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import random
import time

import pulsectl

Expand All @@ -24,11 +23,7 @@ def get_sound_card_online(self):
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!")
Expand Down
6 changes: 1 addition & 5 deletions system/hardware/tici/hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,11 +102,7 @@ def get_sound_card_online(self):
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"])
Expand Down

0 comments on commit baf9887

Please sign in to comment.