Add cover art database

Co-authored-by: Job Curtis <job.curtis@gmail.com>
Co-authored-by: Alex Cabal <alex@standardebooks.org>
This commit is contained in:
Mike Colagrosso 2023-12-28 16:38:39 -06:00 committed by Alex Cabal
parent 74f747df76
commit 6a5c05511a
92 changed files with 3174 additions and 146 deletions

View file

@ -7,7 +7,7 @@ DESCRIPTION
Deploy a Standard Ebook source repository to the web.
USAGE
deploy-ebook-to-www [-v,--verbose] [-g,--group GROUP] [--webroot WEBROOT] [--weburl WEBURL] [--no-images] [--no-build] [--no-epubcheck] [--no-recompose] [--no-feeds] [-l,--last-push-hash HASH] DIRECTORY [DIRECTORY...]
deploy-ebook-to-www [-v,--verbose] [-g,--group GROUP] [--webroot WEBROOT] [--weburl WEBURL] [--no-images] [--no-build] [--no-epubcheck] [--no-recompose] [--no-feeds] [--no-bulk-downloads] [--upsert-to-cover-art-database] [-l,--last-push-hash HASH] DIRECTORY [DIRECTORY...]
DIRECTORY is a bare source repository.
GROUP is a groupname. Defaults to "se".
WEBROOT is the path to your webroot. Defaults to "/standardebooks.org/web/www".
@ -39,6 +39,8 @@ USAGE
With --no-bulk-downloads, don't generate bulk download files.
With --upsert-to-cover-art-database, update/insert cover in the cover art database.
EOF
exit
}
@ -57,6 +59,7 @@ epubcheck="true"
recompose="true"
feeds="true"
bulkDownloads="true"
coverArtDatabase="false"
if [ $# -eq 0 ]; then
usage
@ -114,6 +117,10 @@ while [ $# -gt 0 ]; do
bulkDownloads="false"
shift 1
;;
--upsert-to-cover-art-database)
coverArtDatabase="true"
shift 1
;;
*) break ;;
esac
done
@ -149,6 +156,10 @@ if ! [ -f "${scriptsDir}"/generate-bulk-downloads ]; then
die "\"${scriptsDir}\"/generate-bulk-downloads\" is not a file or could not be found."
fi
if ! [ -f "${scriptsDir}"/upsert-to-cover-art-database ]; then
die "\"${scriptsDir}\"/upsert-to-cover-art-database\" is not a file or could not be found."
fi
mkdir -p "${webRoot}"/images/covers/
for dir in "$@"
@ -387,6 +398,18 @@ do
mv "${imgWorkDir}/${urlSafeIdentifier}"*.{jpg,avif} "${webRoot}/images/covers/"
fi
if [ "${coverArtDatabase}" = "true" ]; then
if [ "${verbose}" = "true" ]; then
printf "Updating/inserting cover in the cover art database ... "
fi
"${scriptsDir}"/upsert-to-cover-art-database --repoDir "${repoDir}" --workDir "${workDir}" --ebookWwwFilesystemPath "${webDir}"
if [ "${verbose}" = "true" ]; then
printf "Done.\n"
fi
fi
# Delete the now-empty work dir (empty except for .git)
rm --preserve-root --recursive --force "${workDir}" "${imgWorkDir}"