Archilyzer · Source

archilyzer

Archilyzer
git clone https://archilyzer.pages.dev/source/archilyzer.git
Log | Files | Refs | README | LICENSE

commit 9f15b79a4dfba6b86fd7edde3760bcedfef4688f
parent 2b89a004c7a17a17144765400839dd84e0f5cda9
Author: I Mean I'm Just Saying <imeanimjustsaying@kiwifarms.st>
Date:   Sat, 21 Nov 2026 18:02:57 -0500

docs: restarts at the live edge, their bounds, and the join's picture and timestamps

OPERATING.md, the ops help (COMMANDS.md regenerated), the stallMinutes
description (SETTINGS.md regenerated) and the editor's changelog say what
REVIEW-2 of live-guard-2 changed.

Co-Authored-By: Claude <noreply@anthropic.com>

Diffstat:
MCOMMANDS.md | 2+-
MOPERATING.md | 29+++++++++++++++++------------
MSETTINGS.md | 2+-
Mcommon/lib/liveCapture.ts | 5+++--
Mcommon/lib/settingsSchema.ts | 2+-
Meditor/CHANGELOG.md | 3++-
Mscripts/archilyzer-ops.mjs | 5+++--
7 files changed, 28 insertions(+), 20 deletions(-)

diff --git a/COMMANDS.md b/COMMANDS.md @@ -147,7 +147,7 @@ Drives a running editor over HTTP (`/api/ops/*`, the same actions its pages run) | `remote-listing` | remote-listing lists an Odysee or BitChute channel upstream and diffs it against what it holds: {"slug"}. One flat-playlist read on the platform's queue (refused while it is held or cooling down; a 429 backs it off), nothing written. `get remote-listing <slug>` waits for the job and prints {listed, held, notHeld: \[{id, url}\], heldNotListed: \[id\], ...} on stdout. | | | `attach-media` | attach-media copies each held video's file out of a LOCAL archive into the saved-video store, as its source container (nothing fetched): {"slug", "source"} — an absolute path to a directory, a .zip (read in place) or a .7z. The id is the folder's trailing "(&lt;id&gt;)", else the file's yt-dlp suffix; "items": \[{"id", "path"}\] names exact files (path inside the source), "match" narrows the folders by regex. "createRecords": true writes a record for a video the channel does not hold; "replace": true re-attaches over a saved container. "fillDates": true gives a held record attach-media made (saved-video.json origin "local-archive") that has no upload\_date the date from its folder's description.txt, through the metadata history ("dated" in the log and summary); a record with a date, or one attach-media did not make, is never touched. "dryRun": true logs each folder's class (attach, not-held, already-attached, lost, no-media, unmatched, ambiguous, and dated) and the held videos with no media in it, and writes nothing. The log ends with a summary: line; a re-run resumes. | `pnpm ops attach-media --json '{"slug":"demo-yt","source":"/abs/YouTube.zip","match":"aaaaaaaaaaa\|bbbbbbbbbbb","fillDates":true,"dryRun":true}' --wait` | | `import-media` | import-media makes ONE file from outside the archive a normal transcribed item: {"slug", "path"} (absolute) and which record — "url" (the source page: one metadata-only pass makes or refreshes the record, under the id the archive keys it by — Rumble's URL id), "id" (a record already here) or "meta": {"title", "date"?, "duration"?, "description"?} (by hand). ffprobe must read it; an MPEG-TS, a .part or an FLV is remuxed -c copy to mp4 (+faststart), never re-encoded. It lands in the saved-video store only when longer than a container already there ("replace": true lands it anyway), then audio.&lt;fmt&gt;, the archive line and media-import.json. "move": true removes the original once the copy verifies; "audio": false lands the container only; "transcribe": true queues a transcribe-one job (held by any pause; without it the transcription lane takes it by its rules); "doNotClean": true marks it, with "note". "dryRun": true says what it would do and writes nothing. A directory, a .zip or a .7z goes to attach-media ("id", "replace", "dryRun" only). | `pnpm ops import-media --json '{"slug":"demo-rumble","path":"/abs/stream.mp4.part","url":"https://rumble.com/v1abcde-title.html","move":true}' --wait`<br>`pnpm ops import-media --json '{"slug":"demo-archive","path":"/abs/talk.mkv","meta":{"title":"A talk","date":"2019-05-01"},"dryRun":true}' --wait` | -| `record-live` | record-live records a live stream until it ends, then lands it as import-media lands a file: {"slug", "url"} (or "id" of a record here), "fromStart"? (true: yt-dlp --live-from-start — Rumble's DVR playlist holds a stream's first 4 hours), "maxHeight"? (720; null = the tallest), "separate"? (true: the video at maxHeight plus the best audio, merged — the default on YouTube, whose live streams from the start offer no single stream with both; false: one muxed stream — Rumble, Kick), "transcribe"?, "doNotClean"?, "note"?, "dryRun"?. On Rumble a refused yt-dlp falls back to the page's own playlist (a browser under xvfb, then ffmpeg). On Kick ("kick.com/&lt;channel&gt;" or its VOD) the ongoing VOD is polled from its first segment beside the channel's live stream. One job per stream; job cancel stops it with SIGINT and lands what it has (video and audio left unmerged are merged, -c copy); the longest part wins. Refused for a stream that is not live. "preclip": true (or {"everyMinutes", "maxChunkMinutes", "overlapSeconds", "scan", "mine", "project"}, over settings.livePreclip) starts live-preclip once the first part begins, and implies "transcribe". A from-start attempt that records nothing (yt-dlp: "The downloaded file is empty"), or only one of its two streams, is tried again at +60 and +180 s, then from the live edge at 0, +60 and +180 s (each wait jittered). The failure's class decides: ended, private/removed, members-only/login and a full or unwritable disk are not retried; a 429 or the bot check gets ONE more try after 15 min, then stops; empty, network and unknown failures keep the schedule; a Cancel ends it. The row records the class (failureClass). A live-edge fallback says what it lost (the first N min of the stream) and needs a person. The landing never removes a part it is not known to contain (an earlier run's, one from another point of the stream, one it cannot land): those are kept in staging and listed (keptParts) until acknowledged. The reply is {jobId, kind, "check"}: the `get live-recordings` command that answers for it. --wait-started returns once a FROM-START part's bytes grow (the recording's row on stdout, exit 0; a run asked fromStart: false, any part's), exit 3 when it records only from the live edge (the start is lost), exit 1 with the reason it failed; 15 minutes by default, --wait-timeout overrides. After a live-edge fallback, from its start is tried again BESIDE the live-edge recording (never touching it): every 15 min (jittered), one try at a time, at most 8; a try that holds the whole stream when landed recovers the start (startRecovery). Each recorder has a stall watchdog: no growth for liveRecording.stallMinutes (10) stops that recorder, its part kept; while the stream still reads live (one metadata read; an exit is read twice, a minute apart) a new part records — at most 3 restarts an hour and 12 a run (restarts). "insurance"?: true \| "whole" \| false — a live-edge recorder beside a from-start recording of a stream already live, until the start has caught up (+5 min), or for the whole stream; absent, on exactly when the stream is marked keep ("doNotClean", the record's Do-not-clean marker, a pending keep) when the recording starts. Its part goes at landing only when the landed file holds the whole stream; otherwise it is kept and listed. After an editor restart, a run the shutdown or a crash interrupted restarts by itself (once per run, 3 an hour per stream, never after a Cancel; liveRecording. autoRestartOnBoot): the new run reads the stream's state first — live, it records; ended, it lands what is in staging; unreadable, it starts nothing and the row needs a person. When no single part holds the stream but two or more together hold more, they are joined (-c copy): an overlap at the point their sound shares, a gap stated by the clock; the joined file lands only when PROVEN (its length, its sound around every join), its parts removed only after; the joins are on the row (joins) and in data/&lt;id&gt;/live-joins.json (each segment's place in the stream and in the file). Unproven, or codecs that differ: the longest lands and the rest are kept. A gap needs a person. | `pnpm ops record-live --json '{"slug":"demo-rumble","url":"https://rumble.com/v1abcde-title.html"}'`<br>`pnpm ops record-live --json '{"slug":"demo-kick","url":"https://kick.com/somechannel"}'`<br>`pnpm ops record-live --json '{"slug":"demo-yt","url":"https://www.youtube.com/watch?v=<id>","preclip":{"everyMinutes":10}}'`<br>`pnpm ops record-live --json '{"slug":"demo-yt","url":"https://www.youtube.com/watch?v=<id>","doNotClean":true}' --wait-started` | +| `record-live` | record-live records a live stream until it ends, then lands it as import-media lands a file: {"slug", "url"} (or "id" of a record here), "fromStart"? (true: yt-dlp --live-from-start — Rumble's DVR playlist holds a stream's first 4 hours), "maxHeight"? (720; null = the tallest), "separate"? (true: the video at maxHeight plus the best audio, merged — the default on YouTube, whose live streams from the start offer no single stream with both; false: one muxed stream — Rumble, Kick), "transcribe"?, "doNotClean"?, "note"?, "dryRun"?. On Rumble a refused yt-dlp falls back to the page's own playlist (a browser under xvfb, then ffmpeg). On Kick ("kick.com/&lt;channel&gt;" or its VOD) the ongoing VOD is polled from its first segment beside the channel's live stream. One job per stream; job cancel stops it with SIGINT and lands what it has (video and audio left unmerged are merged, -c copy); the longest part wins. Refused for a stream that is not live. "preclip": true (or {"everyMinutes", "maxChunkMinutes", "overlapSeconds", "scan", "mine", "project"}, over settings.livePreclip) starts live-preclip once the first part begins, and implies "transcribe". A from-start attempt that records nothing (yt-dlp: "The downloaded file is empty"), or only one of its two streams, is tried again at +60 and +180 s, then from the live edge at 0, +60 and +180 s (each wait jittered). The failure's class decides: ended, private/removed, members-only/login and a full or unwritable disk are not retried; a 429 or the bot check gets ONE more try after 15 min, then stops; empty, network and unknown failures keep the schedule; a Cancel ends it. The row records the class (failureClass). A live-edge fallback says what it lost (the first N min of the stream) and needs a person. The landing never removes a part it is not known to contain (an earlier run's, one from another point of the stream, one it cannot land): those are kept in staging and listed (keptParts) until acknowledged. The reply is {jobId, kind, "check"}: the `get live-recordings` command that answers for it. --wait-started returns once a FROM-START part's bytes grow (the recording's row on stdout, exit 0; a run asked fromStart: false, any part's), exit 3 when it records only from the live edge (the start is lost), exit 1 with the reason it failed; 15 minutes by default, --wait-timeout overrides. After a live-edge fallback, from its start is tried again BESIDE the live-edge recording (never touching it): every 15 min (jittered), one try at a time, at most 8; a try that holds the whole stream when landed recovers the start (startRecovery). Each recorder has a stall watchdog: no growth for liveRecording.stallMinutes (10) stops that recorder, its part kept; while the stream still reads live (one metadata read; an exit is read twice, a minute apart) a new part records from the live edge — at most 6 restarts an hour and 24 a run (restarts); past them the row says the stream is live and NOT recorded. "insurance"?: true \| "whole" \| false — a live-edge recorder beside a from-start recording of a stream already live, until the start has caught up (+5 min), or for the whole stream; absent, on exactly when the stream is marked keep ("doNotClean", the record's Do-not-clean marker, a pending keep) when the recording starts. Its part goes at landing only when the landed file holds the whole stream; otherwise it is kept and listed. After an editor restart, a run the shutdown or a crash interrupted restarts by itself (once per run, 3 an hour per stream, never after a Cancel; liveRecording. autoRestartOnBoot): the new run reads the stream's state first — live, it records; ended, it lands what is in staging; unreadable, it starts nothing and the row needs a person. When no single part holds the stream but two or more together hold more, they are joined (-c copy): an overlap at the point their sound shares, a gap stated by the clock; the joined file lands only when PROVEN (its length, its sound around every join), its parts removed only after; the joins are on the row (joins) and in data/&lt;id&gt;/live-joins.json (each segment's place in the stream and in the file). Unproven, or codecs that differ: the longest lands and the rest are kept. A gap needs a person. | `pnpm ops record-live --json '{"slug":"demo-rumble","url":"https://rumble.com/v1abcde-title.html"}'`<br>`pnpm ops record-live --json '{"slug":"demo-kick","url":"https://kick.com/somechannel"}'`<br>`pnpm ops record-live --json '{"slug":"demo-yt","url":"https://www.youtube.com/watch?v=<id>","preclip":{"everyMinutes":10}}'`<br>`pnpm ops record-live --json '{"slug":"demo-yt","url":"https://www.youtube.com/watch?v=<id>","doNotClean":true}' --wait-started` | | `local-media-configure` | local-media-configure gives a video channel a LOCAL MEDIA LIBRARY: {"slug", "sourceId", "directory"} — a stable lowercase id and an absolute directory on the editor server whose recordings stay where they are (never copied, moved or deleted). Written through the channel config; a channel that already has one is refused, and so is queued or running channel work. Playback is not set. Synchronous. | `pnpm ops local-media-configure --json '{"slug":"demo-local","sourceId":"library-1","directory":"/mnt/recordings"}'` | | `local-media-preview` | local-media-preview scans the library and writes nothing: {"slug"} -&gt; {preview: {sourceToken, counts, candidates}}. Each .mp4 directly in the directory (not its subdirectories) with its same-named .info.json and .vtt (or .srt) is "new", "existing" (its record is held) or "issue" (with issues). The sourceToken and a candidate's fingerprint (or preparationFingerprint, when it has no .info.json) are what the other local-media actions take. An unreachable library is an error, never an empty preview. | `pnpm ops local-media-preview --json '{"slug":"demo-local"}'` | | `local-media-prepare` | local-media-prepare reviews details for a recording with no .info.json and writes nothing: {"slug", "sourceToken", "media", "sourceFingerprint" (the candidate's preparationFingerprint), "details": {"mode": "inspect" \| "manual", "title", "recordedDate"? (YYYY-MM-DD), "durationSeconds"? (manual)}} -&gt; {review: {metadata, fingerprint}}. "inspect" measures the duration with ffprobe. Import it with local-media-import, the review's fingerprint and "preparation": {"sourceFingerprint", "details"}. | `pnpm ops local-media-prepare --json '{"slug":"demo-local","sourceToken":"<token>","media":"talk.mp4","sourceFingerprint":"<fp>","details":{"mode":"inspect","title":"A talk"}}'` | diff --git a/OPERATING.md b/OPERATING.md @@ -1387,15 +1387,19 @@ pnpm ops keep-videos --json '{"slug":"example-rumble","ids":["v1abcde"],"note": the live edge) has a watchdog: its part's files, scratch included, are compared every minute; no growth for `liveRecording.stallMinutes` (10) stops THAT recorder (SIGINT), and its part stays. After a stall with bytes, or a recorder that exited with bytes, one metadata read asks whether the stream is still live (an exit is read twice, a - minute apart: a stream that has just ended may read live a moment). Live: after 30 s a new part (`ytdlp-r<N>`, its - own stem) in the same mode; the earlier part stays for the landing's rules. Ended: the run lands. At most 3 restarts - in any hour and 12 in a run; past that the row says why (`restarts.refused`) and needs a person. What the recorder - said is classified first, also for a part that died with bytes: ended, private, members-only and the disk are not - restarted; a 429 or the bot check gets ONE restart after 15 min, a second is refused. No from-start pass starts - once a from-start part holds the stream up to now (the coverage rule by the clock), and after a recorder that ended - with bytes while the stream still read live at most ONE extra from-start pass is made. The 20 GB floor is read - before every spawn — each restart, each start-recovery try, the insurance's start, a join — and a spawn under it - does not start; the row says so (`spaceHeld`) and needs a person. A stall with nothing written is an attempt that recorded nothing, on the + minute apart: a stream that has just ended may read live a moment). **A stream that reads live is never left + unrecorded quietly, and a restart never re-downloads what a kept part holds**: live, after 30 s a new part from the + LIVE EDGE (`ytdlp-r<N>`, its own stem) — the earlier part holds the past and stays for the landing and the join + (from the start is only the slice-2 tries, when no part holds the stream's start). The stream counts as ended only + on evidence: the state read says so, or three live-edge recorders in a row capture nothing (then, if it still reads + live, the row is loud). At most 6 restarts in any hour and 24 in a run; past them, or when the state cannot be read + after an exit, the row says the stream may be live and is NOT recorded (`restarts.refused`) and needs a person. + What the recorder said LAST (its output after its last progress line) is classified, also for a part that died + with bytes; the state is read before any conclusion: the disk is not restarted; a 429 or the bot check, with the + stream live, gets ONE restart after 15 min, a second is refused; "ended"/"private" text while the stream reads live + is restarted. The floor before every spawn — each restart, start-recovery try, the insurance's start, a join — is + max(20 GB, twice the largest part of this run so far); a spawn under it does not start, and the row says so + (`spaceHeld`) and needs a person. A stall with nothing written is an attempt that recorded nothing, on the schedule above. Not for Kick (its VOD poll decides its end) or the browser path. - **An insurance recorder while the start catches up.** A from-start recording of a stream already live is behind the live edge for a long time; a second recorder records the live edge beside it (`ytdlp-insure`), starting 60 s @@ -1403,7 +1407,7 @@ pnpm ops keep-videos --json '{"slug":"example-rumble","ids":["v1abcde"],"note": it reports within 30 fragments of its total, read from yt-dlp's own `(frag N/M)` lines; none read, it runs to the end). One that exits or stalls before the catch-up or the stream's end reads `died` (never "to the end") and is started again; a from-start restart, behind the live edge again, re-arms one that had stopped after the catch-up; at - most 3 starts a run (`starts`). `"insurance"`: `true` (that), `"whole"` (the whole stream), `false` (none); absent, it is ON exactly when the + most 3 starts a run (`starts`); a rate limit gets one more start after 15 min, then it stops. `"insurance"`: `true` (that), `"whole"` (the whole stream), `false` (none); absent, it is ON exactly when the stream is marked keep before or when the recording starts — `doNotClean` asked, the record's Do-not-clean marker, or a pending keep (`keep-videos`) — and off otherwise. Its part is removed at the landing only when the landed file holds the whole stream; otherwise it is kept and listed (the stream removed mid-catch-up: it holds the end). It @@ -1417,8 +1421,9 @@ pnpm ops keep-videos --json '{"slug":"example-rumble","ids":["v1abcde"],"note": next part is cut where the one before ends (the keyframe before the cut: `duplicatedSeconds` heard twice). A part that starts after the one before ends is joined as it is, and the GAP is stated by the clock — the joined file's timeline after it is not the stream's. The joined file lands only when proven: its length is its segments' within - max(1 s, 0.2 %), the sound 5–25 s either side of every join (and its head and tail) matches its parts, and so does - the PICTURE 10 s either side (a small grey frame); a cut whose copy starts after the point asked (a hole) refuses + max(1 s, 0.2 %), the sound 5–25 s either side of every join (and its head and tail) matches its parts, the two + parts' PICTURES match each other at the same stream times across the overlap (and the timestamps of the joined + file's video and audio run on at every join: on a static scene they alone decide; with neither, no join); a cut whose copy starts after the point asked (a hole) refuses the join, and each overlap records where it was cut (`cutAt`, `cutFrom`). No join runs during a shutdown's landing, and its scratch is removed however it ends. Its parts are removed only after it has landed. The row's `joins` and `data/<id>/live-joins.json` (each segment: its place in the stream, in its file and in the joined file) say where the joins are. A gap needs a person. Unproven, parts whose diff --git a/SETTINGS.md b/SETTINGS.md @@ -267,7 +267,7 @@ How a running live recording is judged and kept alive (record-live; `pnpm ops ge | Key | Default | Description | |---|---|---| -| `stallMinutes` | `10` | Minutes a running live recording's files may go without growing before `pnpm ops get live-recordings` (and /review, the banners) mark it `stalled` — and before record-live's own watchdog stops that recorder and, while the stream is still live, starts a new part (at most 3 restarts an hour, 12 a run). Clamped 1–240; default 10. | +| `stallMinutes` | `10` | Minutes a running live recording's files may go without growing before `pnpm ops get live-recordings` (and /review, the banners) mark it `stalled` — and before record-live's own watchdog stops that recorder and, while the stream is still live, starts a new part from the live edge (at most 6 restarts an hour, 24 a run). Clamped 1–240; default 10. | | `autoRestartOnBoot` | `true` | After an editor restart, a live recording the shutdown (or a crash) interrupted is restarted by itself: the new run reads the stream's state first (one paced metadata request) and records only if it is still live; ended, it lands what is in staging; unreadable, it starts nothing. At most once per interrupted run and 3 times an hour per stream; never after a person's Cancel (common/controller/liveRecordingBoot.ts). Default true; false leaves every interruption to /review's Record again. | Default: diff --git a/common/lib/liveCapture.ts b/common/lib/liveCapture.ts @@ -740,8 +740,9 @@ export type LiveBootRestart = { at: string; by: "boot"; state: LiveBootRestartSt // with bytes, or exited with bytes while the stream still reads live (two // reads LIVE_RESTART_CONFIRM_MS apart — a stream that has just ended may read // live for a moment), is restarted: one metadata read (the read the job makes -// at its end anyway), LIVE_RESTART_WAIT_MS, a new part with its own stem in -// the same mode. Bounded: LIVE_RESTART_MAX_PER_HOUR in any 60 minutes and +// at its end anyway), LIVE_RESTART_WAIT_MS, a new part with its own stem +// from the LIVE EDGE (the earlier part holds the past; REVIEW-2 of +// live-guard-2). Bounded: LIVE_RESTART_MAX_PER_HOUR in any 60 minutes and // LIVE_RESTART_MAX_PER_RUN in all; past either the run lands what it has and // `refused` needs a person. export const LIVE_WATCH_MS = 60_000; diff --git a/common/lib/settingsSchema.ts b/common/lib/settingsSchema.ts @@ -1021,7 +1021,7 @@ export const LIVE_RECORDING_SETTINGS_FIELD_DOCS: FieldDocs<LiveRecordingSettings stallMinutes: "Minutes a running live recording's files may go without growing before `pnpm ops get live-recordings` (and /review, " + "the banners) mark it `stalled` — and before record-live's own watchdog stops that recorder and, while the stream is " + - "still live, starts a new part (at most 3 restarts an hour, 12 a run). Clamped 1–240; default 10.", + "still live, starts a new part from the live edge (at most 6 restarts an hour, 24 a run). Clamped 1–240; default 10.", autoRestartOnBoot: "After an editor restart, a live recording the shutdown (or a crash) interrupted is restarted by itself: the new run " + "reads the stream's state first (one paced metadata request) and records only if it is still live; ended, it lands what " + diff --git a/editor/CHANGELOG.md b/editor/CHANGELOG.md @@ -6,7 +6,8 @@ - After a fallback to the live edge, from its start is tried again beside it every 15 min, at most 8 times; a try that lands the whole stream recovers the start. - A recorder whose files stop growing for `liveRecording.stallMinutes`, or that exits while the stream still reads - live, is restarted as a new part (at most 3 an hour, 12 a run); its earlier part stays for the landing. + live, is restarted as a new part from the live edge (at most 6 an hour, 24 a run); its earlier part stays for the + landing, and a stream that reads live is never left unrecorded quietly. - `"insurance"` on record-live: a live-edge recorder beside a from-start recording until it catches up (or the whole stream). On by default for a stream marked keep. - After an editor restart, a recording the shutdown or a crash interrupted restarts by itself once the stream reads diff --git a/scripts/archilyzer-ops.mjs b/scripts/archilyzer-ops.mjs @@ -2766,8 +2766,9 @@ export function usage() { " recovers the start (startRecovery). Each recorder has a stall watchdog:", " no growth for liveRecording.stallMinutes (10) stops that recorder, its", " part kept; while the stream still reads live (one metadata read; an exit", - " is read twice, a minute apart) a new part records — at most 3 restarts", - " an hour and 12 a run (restarts). \"insurance\"?: true | \"whole\" | false —", + " is read twice, a minute apart) a new part records from the live edge —", + " at most 6 restarts an hour and 24 a run (restarts); past them the row", + " says the stream is live and NOT recorded. \"insurance\"?: true | \"whole\" | false —", " a live-edge recorder beside a from-start recording of a stream already", " live, until the start has caught up (+5 min), or for the whole stream;", " absent, on exactly when the stream is marked keep (\"doNotClean\", the",