Difference between revisions of "Make library card catalogue PDFs with Python scripts"
Line 4: | Line 4: | ||
* a cloned git repository | * a cloned git repository | ||
* [[calibrestekje]], a python-bindings library | * [[calibrestekje]], a python-bindings library | ||
* a metadata.db file as produced by an installation of [[Calibre]] | * a metadata.db file as produced by an existing installation of [[Calibre]]* | ||
*To see the guide, look at installing [[Calibre]]. | |||
== Getting started == | == Getting started == |
Revision as of 17:44, 20 October 2021
This recipe depends on the installation of
- a python virtual environment
- a cloned git repository
- calibrestekje, a python-bindings library
- a metadata.db file as produced by an existing installation of Calibre*
- To see the guide, look at installing Calibre.
Getting started
First, clone the git and change to the new bootleg/
directory:
git clone https://git.xpub.nl/simoon/bootleg.git
cd bootleg/
In the bootleg/
directory, create and activate a python virtual environment. Once activated, you'll notice the prompt in the terminal has changed to be prefaced by (venv)
, which indicates that the virtual environment is active.
python3 -m venv venv
source venv/bin/activate
Then, install dependencies in the python environment.
pip install reportlab
pip install calibrestekje
pip install pillow
Make sure you have a valid metadata.db
file in the same bootleg/
directory. One which is usually produced the first time you run Calibre in a path similar to /home/myusername/calibre/metadata.db
on Debian and Unix-like systems. This file is usually kept with the contents of the Calibre book collection.
Next, run this command:
python3 reportlab_image_poster.py
This will produce a PDF, and also a list of the contents. In my case, it produced a 1048 page PDF in seconds, with the title and author of each book on separate pages of a card catalogue.