summaryrefslogtreecommitdiff
path: root/server/cmd
diff options
context:
space:
mode:
authorPeter Stone <thepeterstone@gmail.com>2026-10-24 09:01:05 +0000
committerPeter Stone <thepeterstone@gmail.com>2026-10-24 09:01:05 +0000
commit34e50c04b18313d92e3b3a565965675fd8b50b8a (patch)
treeba408851ac65071383d21060f6c133edd09cfb30 /server/cmd
parentbc33a9bdee12e41ed8b017c3f751a5dcdf6d1c97 (diff)
Send the listener's labels to the server and keep them
The phone has had two kinds of label and nowhere to put them: a mark, which is a judgement on a break detection found, and a report, which is the notification button pointing at advertising it missed. They catch opposite errors, and the signature library needs both. POST /api/labels now takes them and state.json keeps them. Episodes are named by feed and guid rather than by either side's own id -- the phone never sees the server's, and the server's belongs to a mirror that forgets an episode after eight. The labels sit beside the shows rather than on them for the same reason: the corpus has to outlive the audio it was given on. A report's end is sent as guessed or measured. It is only measured once the listener came back and trimmed it; otherwise it is wherever the jump landed, and a signature cut to that would carry programme. The phone re-sends everything each sweep and keeps no record of what arrived. The server replaces rather than accumulating, so a re-send is free, there is no sync state to get wrong, and a label lost to a crash comes back on the next refresh. Gated on audioFromServer, like every other server re-query: a label names a position in a particular file, and dynamic ad insertion means the publisher's copy is a different one. Accepting a label writes the state file immediately. Everything else is written at the end of a poll cycle, which for 61 feeds is hours, and a tap made once should not wait that long to become durable. Deployed and checked against the live server: a label is accepted, a re-send leaves one, an unauthenticated POST gets 401, and the label is on disk within seconds. The probe label used for that check was removed afterwards. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018AwnALZL6bD4VBtATDVv3B
Diffstat (limited to 'server/cmd')
-rw-r--r--server/cmd/listend/main.go4
1 files changed, 4 insertions, 0 deletions
diff --git a/server/cmd/listend/main.go b/server/cmd/listend/main.go
index 524f438..c500a63 100644
--- a/server/cmd/listend/main.go
+++ b/server/cmd/listend/main.go
@@ -83,6 +83,10 @@ func main() {
worker.save()
worker.wake()
},
+ // Same reasoning, one step smaller: a label is a tap the listener made once, and it
+ // should not sit in memory until the end of a poll cycle. No wake -- nothing acts on a
+ // label yet, it is corpus for the signature library.
+ OnLabels: worker.save,
})
ctx, stop := signal.NotifyContext(context.Background(), syscall.SIGINT, syscall.SIGTERM)