Reserve output while a saved demo is playing

This commit is contained in:
firestar5683
2026-09-20 11:09:06 -07:00
parent a64c8a7849
commit 0fbe1da65e
2 changed files with 12 additions and 1 deletions
+2 -1
View File
@@ -100,7 +100,8 @@ def playback_process_active(proc=Path('/proc')):
if not path.name.isdigit():continue
try:cmd=(path/'cmdline').read_bytes().replace(b'\0',b' ')
except OSError:continue
if any(name in cmd for name in (b'/prototype/app.py',b'/prototype/stored_score.py')):return True
if any(name in cmd for name in (b'/prototype/app.py',b'/prototype/stored_score.py',b'/prototype/native_prepared_showcase.py')):return True
if b'/prototype/mac_showcase.py' in cmd and b'--audio-worker' in cmd:return True
except OSError:return True
return False
+10
View File
@@ -69,5 +69,15 @@ class SavedDemoTests(unittest.TestCase):
self.assertEqual(self.stops,[])
with self.assertRaises(ValueError):self.service.start(self.request)
def test_prepared_playback_reserves_output_from_calibration(self):
from operator_output import playback_process_active
proc=self.root/'proc';child=proc/'45';child.mkdir(parents=True)
for command in (b'python\0/data/roadscore/prototype/native_prepared_showcase.py\0--demo',
b'python\0/data/roadscore/prototype/mac_showcase.py\0--audio-worker'):
(child/'cmdline').write_bytes(command)
self.assertTrue(playback_process_active(proc))
(child/'cmdline').write_bytes(b'python\0/data/roadscore/prototype/worker_service.py')
self.assertFalse(playback_process_active(proc))
if __name__=='__main__':unittest.main()