-
-
Notifications
You must be signed in to change notification settings - Fork 0
Description
We need a maintenance script to populate CMS database with existing books.
This maintenance script needs to:
- automatically create missing titles and associate them with their collection
- automatically create missing books and associate them with their title
It hence assumes that all ZIM in production have a correct title.
The script can assume that:
- usual environment variables are set:
DATABASE_URL,LOCAL_WAREHOUSE_PATHS,QUARANTINE_WAREHOUSE_ID,QUARANTINE_BASE_PATH,STAGING_WAREHOUSE_ID,STAGING_BASE_PATH - DB is reachable, ZIM files are locally available
- DB is properly configured with warehouses and collections (including their paths)
- Every title has only one collection configured (the case where we wanna publish a single title in two distinct collections does not exist)
The script will explore all warehouses for ZIMs, create titles, associate them with proper collection, create books.
The script will hence needs to use the python-libzim to open the ZIM and retrieve ZIM metadata.
The script will be idempotent, i.e. it can be ran twice in a row without creating duplicate records in the DB.
Zimcheck results will be left empty, no need to recompute them for the time being.
Title and book events will be populated with clear indication that its the maintenance script which performed operations.
The script will not need to be packaged in any form, it will be manually deployed and configured on proper server.