mirror of
https://github.com/standardebooks/web.git
synced 2025-07-06 14:50:39 -04:00
Initial script to insert/update Ebook records
This commit is contained in:
parent
63d411a2e6
commit
ccd73c7cb4
2 changed files with 40 additions and 8 deletions
|
@ -57,7 +57,6 @@ epubcheck="true"
|
||||||
recompose="true"
|
recompose="true"
|
||||||
feeds="true"
|
feeds="true"
|
||||||
bulkDownloads="true"
|
bulkDownloads="true"
|
||||||
coverArtDatabase="false"
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]; then
|
if [ $# -eq 0 ]; then
|
||||||
usage
|
usage
|
||||||
|
@ -388,14 +387,16 @@ do
|
||||||
mv "${imgWorkDir}/${urlSafeIdentifier}"*.{jpg,avif} "${webRoot}/images/covers/"
|
mv "${imgWorkDir}/${urlSafeIdentifier}"*.{jpg,avif} "${webRoot}/images/covers/"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ "${coverArtDatabase}" = "true" ]; then
|
verboseDbFlag=""
|
||||||
if [ "${verbose}" = "true" ]; then
|
if [ "${verbose}" = "true" ]; then
|
||||||
printf "Updating/inserting cover in the cover art database ... "
|
verboseDbFlag="--verbose"
|
||||||
fi
|
printf "Updating/inserting ebook in database ... "
|
||||||
|
fi
|
||||||
|
|
||||||
if [ "${verbose}" = "true" ]; then
|
"${scriptsDir}"/update-ebook-database ${verboseDbFlag} --ebookWwwFilesystemPath "${webDir}"
|
||||||
printf "Done.\n"
|
|
||||||
fi
|
if [ "${verbose}" = "true" ]; then
|
||||||
|
printf "Done.\n"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Delete the now-empty work dir (empty except for .git)
|
# Delete the now-empty work dir (empty except for .git)
|
||||||
|
|
31
scripts/update-ebook-database
Executable file
31
scripts/update-ebook-database
Executable file
|
@ -0,0 +1,31 @@
|
||||||
|
#!/usr/bin/php
|
||||||
|
<?
|
||||||
|
require_once('/standardebooks.org/web/lib/Core.php');
|
||||||
|
|
||||||
|
$longopts = ['ebookWwwFilesystemPath:', 'verbose'];
|
||||||
|
$options = getopt('v', $longopts);
|
||||||
|
|
||||||
|
$ebookWwwFilesystemPath = $options['ebookWwwFilesystemPath'] ?? false;
|
||||||
|
|
||||||
|
$verbose = false;
|
||||||
|
if(isset($options['v']) || isset($options['verbose'])){
|
||||||
|
$verbose = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(!$ebookWwwFilesystemPath){
|
||||||
|
print("Expected usage: update-ebook-database [-v] --ebookWwwFilesystemPath <path>\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();
|
Loading…
Add table
Add a link
Reference in a new issue