integrated into gutenberg-mirror-browser now

This commit is contained in:
2024-10-09 11:36:39 -07:00
parent 148383b78d
commit 285b9d2636
5 changed files with 15 additions and 17 deletions

25
html-to-epub.sh Normal file
View File

@@ -0,0 +1,25 @@
#!/usr/bin/env bash
cd $LIBRARY_PATH
for srcdir in $(find html-src -name \*-h -type d)
do
srcfile=$(echo $srcdir/$(basename $srcdir).htm)
prefix=$(basename -s -h.htm $srcfile)
echo $prefix
destpath=$(echo $(dirname $(dirname $srcfile)) | sed "s/^html-src/ebooks/")
mkdir -p $destpath
if [ $srcfile -nt $destpath/$prefix.epub ]
then
ebookmaker --make kindle.images --generate_cover --output-dir $destpath $srcfile 2>&1 >/dev/null
coverfile=$(ls $destpath/*.png)
if [ "$coverfile" != "" ]
then
ebookmaker --make kindle.images --cover $coverfile --output-dir $destpath $srcfile 2>&1 >/dev/null
fi
rm -f $destpath/$prefix.epub $destpath/$prefix.mobi 2>&1 >/dev/null
mv $destpath/*.epub $destpath/$prefix.epub
mv $destpath/*.mobi $destpath/$prefix.mobi
rm -f $coverfile 2>&1 >/dev/null
echo update books set epub=1 where book_id=$prefix\; | mariadb -h $DB_HOST -u $DB_USER --password=$DB_PASS $DB_DATA
fi
done