From ccd73c7cb4f4359c1ba2bd86d06b7168e1ca81f2 Mon Sep 17 00:00:00 2001 From: Mike Colagrosso Date: Sat, 20 Apr 2024 23:22:15 -0600 Subject: [PATCH] Initial script to insert/update Ebook records --- scripts/deploy-ebook-to-www | 17 +++++++++-------- scripts/update-ebook-database | 31 +++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+), 8 deletions(-) create mode 100755 scripts/update-ebook-database diff --git a/scripts/deploy-ebook-to-www b/scripts/deploy-ebook-to-www index 422b94af..83a9d22e 100755 --- a/scripts/deploy-ebook-to-www +++ b/scripts/deploy-ebook-to-www @@ -57,7 +57,6 @@ epubcheck="true" recompose="true" feeds="true" bulkDownloads="true" -coverArtDatabase="false" if [ $# -eq 0 ]; then usage @@ -388,14 +387,16 @@ 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 + verboseDbFlag="" + if [ "${verbose}" = "true" ]; then + verboseDbFlag="--verbose" + printf "Updating/inserting ebook in database ... " + fi - if [ "${verbose}" = "true" ]; then - printf "Done.\n" - fi + "${scriptsDir}"/update-ebook-database ${verboseDbFlag} --ebookWwwFilesystemPath "${webDir}" + + if [ "${verbose}" = "true" ]; then + printf "Done.\n" fi # Delete the now-empty work dir (empty except for .git) diff --git a/scripts/update-ebook-database b/scripts/update-ebook-database new file mode 100755 index 00000000..d4051762 --- /dev/null +++ b/scripts/update-ebook-database @@ -0,0 +1,31 @@ +#!/usr/bin/php +\n"); + exit(1); +} + +if($verbose){ + print("ebookWwwFilesystemPath: $ebookWwwFilesystemPath\n"); +} + +$ebook = new Ebook($ebookWwwFilesystemPath); + +if($verbose){ + print("Title: $ebook->Title\n"); + print("Identifier: $ebook->Identifier\n"); +} + +$ebook->CreateOrUpdate();