Skip to content

feat(library): keep auto-organize shelves filed by their template - #59

Merged
audemed44 merged 2 commits into
mainfrom
feat/auto-organize
Oct 24, 2026
Merged

audemed44 merged 2 commits into
mainfrom
feat/auto-organize

Conversation

@audemed44

Copy link
Copy Markdown
Owner

Why

The organizer listed most of the Library shelf as needing a move, including serial volumes saved as slugs at the top of the shelf (pact-endgame.epub). The shelf's "Auto-organize on scan" option said files "are reorganized automatically after each scan", but it only applied when a book was moved onto the shelf. Uploads, Z-Library downloads, files a scan found and newly built serial volumes were never filed.

What

  • Auto-organize works as described. For every shelf with it on, books are filed by the shelf's template after each scan, and a few seconds after edits such as adding a book to a series or building a volume. It runs together with the EPUB metadata sync from feat(library): write series, genres and tags into epub files #58, under the same lock as the scan. A serial check that built volumes also triggers it. Each move is audit-logged.
  • Moves don't destroy other books. Previously a move overwrote whatever was at the destination. Now an identical copy is still replaced, but a different file is left alone and the book is reported as not organized.
  • The organizer page starts from the shelf's saved template and sequence padding, instead of a fixed default.
  • The toggle is now just "Auto-organize", with help text that says what it does.
  • Sidebar (separate commit): the desktop sidebar's links scroll when the window is too short to show them all.

Testing

  • Go: new TestAutoOrganize covers the shelf option off, filing into Series/NN - Title, a different file at the destination (kept, book not moved) and an identical copy (replaced). Full go vet and go test -race pass.
  • Frontend: lint, prettier, tsc, 329 tests and the build pass.
  • Checked in Chromium at 1280×520: the sidebar nav scrolls (446 px of content in 298 px) and reaches Settings.
  • Organizer preview on live data with the template {series_path}/{sequence| - }{title}: 402 of 559 Library books would move, none to the same path. The KOReader shelf has 0 to move.

After deploy

The Library shelf has auto-organize off and no saved template, so nothing moves until it's turned on in the shelf's settings. Once it is, the next sync files all 402 books.

The shelf option promised files "are reorganized automatically after each
scan", but it only applied when moving a book onto the shelf. Uploads,
Z-Library downloads, files a scan found and serial volumes (built as
slugs like pact-endgame.epub) all stayed at the top of the shelf.

Auto-organize shelves are now filed by their template after every scan
and a few seconds after edits (adding a book to a series, building a
volume), together with the EPUB metadata sync. The organizer page starts
from the shelf's saved template instead of a fixed default.

Moves no longer overwrite a different file at the destination; an
identical copy there is still replaced.
On a short desktop window the links below the fold were cut off: the
sidebar is fixed at full height and its nav never scrolled.
@audemed44
audemed44 merged commit 39ae497 into main Oct 24, 2026
2 checks passed
@audemed44
audemed44 deleted the feat/auto-organize branch October 24, 2026 21:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant