feat: ingest Brevier reading copies and phone notes #53

Merged
david merged 1 commits from feat/brevier-ingest into main 2026-11-09 00:31:34 +00:00
Owner

Closes #48.

Brevier keeps a copy of every page read and can export notes from the phone. None of it reached knox.

Archive copies

<archive>/<host>/<date>-<slug>.md.lz4, or .md when the reader turns plain copies on. Front matter is title / source / read, then the article Markdown.

  • Both forms are read. The plain-copy setting only changes how new copies are written; older ones stay compressed. Reading one form would silently drop half the archive.
  • Keyed by source URL, not by file. Brevier writes one file per page per day, so a file-keyed source would add a duplicate entry every time a page is re-read. Here a re-read updates the entry and the content hash carries the version.
  • Created time comes from the copy's read stamp, normalised to UTC.
  • The default path also checks the Flatpak sandbox (~/.var/app/io.github.gurov.brevier/data/brevier/archive), which is where a desktop install actually writes.

Phone exports

The phone's archive is app-private and never leaves the device — upstream leaves bulk export undecided (roadmap #15). What can arrive is the notes export (Your notes → share) and per-page Save. Both go into BREVIER_INBOX (default ~/.local/share/knox/inbox/brevier), which a Syncthing folder can mirror.

Three shapes are handled:

Shape Source id
one page, front matter with source brevier-notes
a zip, one .md per page (images ignored) brevier-notes
one file with ## [title](url) sections brevier-notes
saved article, no front matter brevier, reading/saved

A saved article has no address in the file, so it is keyed by its content — re-saving an unchanged page dedupes, and a changed one is a new version.

Wiring

knox brevier, included in knox ingest, and an hourly ticker inside LocalSourcesEnabled() (the archive only changes when something is read).

Verification

  • go test ./... and go vet green.
  • Tests cover: plain + compressed copies, one fingerprint across days with the newest winning, phone file and zip (images skipped), multi-page section parsing, URL-less saves deduping, and missing directories being a no-op.
  • On this host Brevier is not installed, so knox brevier correctly reports "No Brevier copies or note exports found" — live data needs the phone or a desktop archive.

Not in scope

Bulk archive export from the phone; that is an upstream feature (declined for now, see #49).

Closes #48. Brevier keeps a copy of every page read and can export notes from the phone. None of it reached knox. ## Archive copies `<archive>/<host>/<date>-<slug>.md.lz4`, or `.md` when the reader turns plain copies on. Front matter is `title / source / read`, then the article Markdown. - **Both forms are read.** The plain-copy setting only changes how *new* copies are written; older ones stay compressed. Reading one form would silently drop half the archive. - **Keyed by source URL**, not by file. Brevier writes one file per page *per day*, so a file-keyed source would add a duplicate entry every time a page is re-read. Here a re-read updates the entry and the content hash carries the version. - Created time comes from the copy's `read` stamp, normalised to UTC. - The default path also checks the Flatpak sandbox (`~/.var/app/io.github.gurov.brevier/data/brevier/archive`), which is where a desktop install actually writes. ## Phone exports The phone's archive is app-private and never leaves the device — upstream leaves bulk export undecided (roadmap #15). What *can* arrive is the notes export (**Your notes** → share) and per-page **Save**. Both go into `BREVIER_INBOX` (default `~/.local/share/knox/inbox/brevier`), which a Syncthing folder can mirror. Three shapes are handled: | Shape | Source id | |---|---| | one page, front matter with `source` | `brevier-notes` | | a zip, one `.md` per page (images ignored) | `brevier-notes` | | one file with `## [title](url)` sections | `brevier-notes` | | saved article, no front matter | `brevier`, `reading/saved` | A saved article has no address in the file, so it is keyed by its content — re-saving an unchanged page dedupes, and a changed one is a new version. ## Wiring `knox brevier`, included in `knox ingest`, and an hourly ticker inside `LocalSourcesEnabled()` (the archive only changes when something is read). ## Verification - `go test ./...` and `go vet` green. - Tests cover: plain + compressed copies, one fingerprint across days with the newest winning, phone file and zip (images skipped), multi-page section parsing, URL-less saves deduping, and missing directories being a no-op. - On this host Brevier is not installed, so `knox brevier` correctly reports "No Brevier copies or note exports found" — live data needs the phone or a desktop archive. ## Not in scope Bulk archive export from the phone; that is an upstream feature (declined for now, see #49).
david added 1 commit 2026-11-09 00:31:23 +00:00
feat: ingest Brevier reading copies and phone notes (#48)
build / test (push) Has been cancelled
build / image (push) Has been cancelled
e7b65c1fea
Brevier keeps a copy of every page read and exports notes from the phone, and
none of it reached knox. This adds a source for both.

Archive copies are Markdown with title/source/read front matter, written as
<archive>/<host>/<date>-<slug>.md.lz4 or .md depending on the reader's setting.
Both forms are read: the setting only changes how new copies are written, and
the older ones stay compressed. Entries are keyed by the source URL, so a page
read on several days updates one entry and the content hash carries the
version, instead of the archive's one-file-per-day turning into duplicate
entries.

The phone is a different problem. Its archive is app-private and never leaves
the device (upstream leaves bulk export undecided), so what can arrive is the
notes export and per-page saves. Those are dropped into an inbox directory and
read in both shapes Brevier produces: one file with front matter, a zip with one
page per file, and a single file with '## [title](url)' sections. A saved
article carries no address, so it is keyed by its content; re-saving an
unchanged page dedupes.

Also checks the Flatpak sandbox path for the archive, since that is where a
desktop install actually writes.
david merged commit 6242f21e3d into main 2026-11-09 00:31:34 +00:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: david/knox#53