The app hears how far apart a game's streams are, and Admin says it (#167) #171
No reviewers
Labels
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
cmoriarty/sports-breaker!171
Loading…
Reference in a new issue
No description provided.
Delete branch "worktree-measure-and-show"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Step 1 of the milestone "Swaps keep your place" (#167). Nothing a viewer sees changes: no swap lands differently. Landing a swap on the same moment is #168, which builds on what this step learns.
What it does
backend/app/sound.py,backend/app/offsets.py).The owner's two cases
What it costs
STREAM_COMPARE_ENABLED=0turns all of it off.How it was checked
make test: 1,395 passed and 1 skipped, in 27 s.npm --prefix frontend test: 281 passed.make e2epassed.openspec validate measure-and-show --strictpasses.Not checked on a live game
Nothing here has run against a live stream: opening a channel reads streaming sites, which needs the owner's word. To look at after a deploy:
Decisions taken without the owner, which he may reverse
Closes #167 when merged, though its live checks remain.
🤖 Generated with Claude Code
When the channel changes stream, the picture jumps to another moment of the game: a new stream starts three segments from its end, and nothing compares where the two streams are in the game. On 2026-11-14 two streams of one game ran 5 to 16 s apart, and a swap moved the picture up to 24 s. The app knew none of it. This is step 1 of the milestone "Swaps keep your place": measure and show. No swap lands differently. The watch already downloads each standby's newest segment every 45 s. Its sound is now located in the sound of the stream the channel is playing (sound.py: the segment's audio packets copied out, decoded to 8 kHz mono by ffmpeg in a worker thread, and found by normalised cross-correlation). Where it fits gives the relation between the two streams' own clocks, kept per pair of streams (offsets.py). A standby that is ahead shows a moment the playing stream has not reached, so it is looked for at once and again 20 s and 45 s later. One comparison runs at a time. A relation is found at its first match and trusted once matches three minutes apart agree within 0.1 s: two different games can carry the same commercial. A sample that does not match changes nothing, so two streams of one game from different markets keep their relation through a break. A match at another place replaces it, and a stream whose clock jumps loses it. A pair compared for five minutes with no match reads "No match": another game, or another broadcast of this one. The game page shows it in a tag beside a kept link's state ("11.6 s ahead", "4.8 s behind", "Same stream", "No match"), quiet until the relation is trusted and when the last samples did not confirm it. The figure is how much sooner the link shows a moment than the stream playing, from each link's freshest listings over ten minutes; the gap between two streams' newest segments wobbles by a segment or two. Every change of stream now records how far the picture moved (moved_seconds, moved_by): by the timestamps when both sites carry one stream, by the relation when it is trusted or matched within the last minute, and not at all otherwise. The splice is read off the timeline once it is stamped, a moment after the event is written, so the event is amended in memory and by one more line in the events file, which is merged on load. The game's Log row leads with it in a tag ("Back 6.0 s"), in a row that is two lines tall from the start so the tag moves nothing, and the Link row's band says it behind its hover. No request is added for a stream in the clear. An encrypted standby needs its key to be heard: one small request per comparison, every 45 s until the relation is trusted and every three minutes after. numpy is a new dependency. STREAM_COMPARE_ENABLED=0 turns it all off. Tested with streams generated in the test (noise from a seed, cut and timestamped differently per stream): no broadcast sound is in the repository. Run offline on the real recordings of 2026-11-14, the new code found the same relations to the millisecond and no match for the wrong game. Not yet run against a live stream. OpenSpec change: measure-and-show. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>