integrated into gutenberg-mirror-browser now
This commit is contained in:
25
html-to-epub.sh
Normal file
25
html-to-epub.sh
Normal 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
|
||||
Reference in New Issue
Block a user