Skip to content

fix(ingest): read metadata.db from the database path in split-library mode - #1667

Open
pcc0x wants to merge 1 commit into
crocodilestick:mainfrom
pcc0x:fix-split-library-checksum
Open

pcc0x wants to merge 1 commit into
crocodilestick:mainfrom
pcc0x:fix-split-library-checksum

Conversation

@pcc0x

@pcc0x pcc0x commented Nov 10, 2026

Copy link
Copy Markdown

Fixes #1513.

With split library on, every import logs "no such table: books" and leaves an empty metadata.db in the books folder, so no KOReader checksum is stored for new books. generate_book_checksums opens metadata.db under self.library_dir, but in split-library mode library_dir has already been switched to the books folder.

The fix uses self.metadata_db, which is set before that switch. Book file paths keep using library_dir, since that is where the files are.

This is the checksum part of #1474, split out so it can merge on its own; that PR conflicts with main and also changes other files. The fix and the test follow it. Two changes against current main: the KOReader sync check added above this line stays, and the test turns that setting on, otherwise the function returns before the checksum code runs.

How I tested it:

  • The new unit test fails on main with "no such table: books" and passes with the fix.
  • pytest -m "smoke or unit" as in the tests workflow, on Python 3.13: 273 passed, 26 skipped.
  • A fresh v4.0.8 container with split library and KOReader sync turned on, importing one EPUB. Without the fix: the error above, an empty metadata.db in the books folder and no checksum row. With the fixed ingest_processor.py mounted in: no error, no metadata.db in the books folder, and the checksum is stored.

I used Claude (AI assistant) to help write this change; I reviewed it before opening.

… mode

generate_book_checksums() opened os.path.join(self.library_dir, "metadata.db"),
but in split-library mode library_dir is switched to the book-files folder.
sqlite3 then created an empty metadata.db there and every import logged
"no such table: books", so no KOReader checksum was stored.

Use self.metadata_db, which is set before the switch. Book file paths keep
using library_dir. The fix and test follow PR crocodilestick#1474.

Fixes crocodilestick#1513

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

[bug] Checksum generation uses wrong metadata.db path with split libraries

1 participant