Fix media stop, upload cleanup and review findings

- Stop is a no-op when the collected player unit is already gone
  (raw systemctl stop exits 5 on the Frame; verified 2026-09-29).
- Surface systemd-run stderr when the player can't start.
- Keep the copy error if the cleanup ssh also fails; reject upload
  names that the play path can never accept.
- Allow 60 s for play (ffprobe 30 s + systemd-run 15 s remote).
- Docs: four-hour cap is unconditional; no delete action yet; fix a
  garbled timing sentence.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
saphidandClaude Opus 5.5 committed 2026-09-29 09:22:22 +10:00
1 parent 4d4e45f622
commit f81f70ed5d
4 files changed
+40 -12

No files matched your search

+18 -1
View File
@@ -83,9 +83,26 @@ class Media(unittest.TestCase):
ssh.assert_not_called()
def test_fake_frame_stop_only_owns_our_unit(self):
with patch.object(remote.subprocess, 'run') as run, patch.object(remote, 'status', return_value={}):
with patch.object(remote.subprocess, 'run') as run, patch.object(remote, 'status', return_value={}), \
patch.object(remote, 'active', return_value=True):
remote.run({'action': 'stop'})
self.assertEqual(run.call_args.args[0], ['systemctl', '--user', 'stop', 'frame-control-media.service'])
# A finished player is already collected; Stop is then a no-op, not an error.
with patch.object(remote.subprocess, 'run') as run, patch.object(remote, 'status', return_value={}), \
patch.object(remote, 'active', return_value=False):
remote.run({'action': 'stop'})
run.assert_not_called()
def test_upload_rejects_unplayable_names_and_keeps_copy_error(self):
with patch.object(server, 'ssh') as ssh, patch.object(server, 'push_file') as push:
for name in ('.hidden.mp4', 'a\\b_SBS.mp4'):
with self.assertRaises(server.Failure):
server.push_media(Path('/tmp')/name)
ssh.assert_not_called()
push.side_effect = server.Failure('copy failed')
ssh.side_effect = [None, server.Failure('link down')]
with self.assertRaisesRegex(server.Failure, 'copy failed'):
server.push_media(Path('/tmp/film_SBS.mp4'))
def test_splat_invalid_records_and_stereo_parallax(self):
with tempfile.TemporaryDirectory() as d: