You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

64 lines
2.9 KiB
Markdown

8 months ago
Bootleglibrary
====================
8 months ago
The digital bootleg library in its current configuration lives on a Calibre-web installation on a RPi4.
The path to the library (books and metadata.db) should be:
/media/usb/'Bootleg Library'
or something similar.
There are two USB drives auto-mounted to the RPi, one for the library (mounted to the path mentioned above) and one for the backup.
Every Monday at 02:00 a cronjob runs to backup from the library USB to the backup USB.
More about how the library is set up here: https://pzwiki.wdka.nl/mediadesign/User:Simon/Trim4/prototypes/bootleg_library_setup
Login (after http-password)
Default admin login
Username: admin
Password: admin123
-----
The library is currently down because of an error with the database, which is malformed, giving the following error:
(sqlite3.DatabaseError) database disk image is malformed
Most likely this is because the USB has become corrupted, including the metadata.db file.
However, each folder of each book includes a metadata.opf file. From these, it is possible to regenerate the metadata.db file, using calibredb: https://manual.calibre-ebook.com/generated/en/calibredb.html#restore-database
It is possible to recover the database by running calibredb from the command line, as suggested by the developer of calibre, Kovid Goyal (in post #2): https://www.mobileread.com/forums/showthread.php?t=262064
I tried this, and Calibre couldn't find a file needed to regenerate the database "metadata_pre_restore.db". This file, and the "metadata.db" file are supposed to be automatically generated when installing Calibre.
4 Oct 2023
Restoring with calibre was tricky as the library rebuilding tools (calibredb restore_database) and also using Calibre's graphical interface to restore a library, both only found those books that had an OPF file. Unfortunately, it seems that the OPF file isn't automatically created when books are added (and perhaps not edited) in calibre-web. SO... it's possible to use calibredb's add command to re-add all the books back and rebuild everything. BUT, the downside here is that all the the books will get renumbered and thus break all existing links (which feels like a big pity as someone who likes to link to specific books / pages).
SO what I am doing is:
8 months ago
# Locally on my laptop, I rebuild a new library with:
8 months ago
calibredb add -r -1 --library-path=tmp/ Bootleg\ Library/
8 months ago
where tmp is a new directory...
NB: all the books that are found and added get an OPF file.
8 months ago
8 months ago
# Copy the OPF file from the newly generated library, into the old library for books that have no OPF file already. In doing this, REWRITE the OPF calibre_id to match the old ID (which is in the folder name).
For this I used the script [add_missing_opf.py](scripts/add_missing_opf.py)
# Finally ran
8 months ago
calibredb restore_database
8 months ago
Sources / Links
-------------------------
* [git](https://git.xpub.nl/XPUB/bootleglibrary)
* [pad](https://pad.xpub.nl/p/bootleg_library_setup)
8 months ago