View Single Post
Old 11-01-2018, 06:00 AM   #43
sdblepas
Junior Member
sdblepas began at the beginning.
 
Posts: 6
Karma: 10
Join Date: Jul 2010
Device: none
Hi Guys
Found this post on google
don't know if that will help but I wrote a small (stupid) scripts to do the following
1. see if there's a new book to add
2. convert the book from epub to mobi
3. add the book
4. add the .mobi as a format of the book
5. rm the book
6. restart calibre

I'm on Ubuntu with calibre-server (no UI)

I call the script vi cron

There's a lot that can be added here with parameters and book format ... I'll see if I get to it and update this thread

Quote:

#!/bin/sh

cd <PATH TO DIR>

count=`ls -1 *.epub 2>/dev/null | wc -l`
if [ $count -eq 0 ]; then
echo "File not found!"
exit 0
fi
cd <PATH TO DIR>

for book in *.epub
do
echo "Converting $book"
ebook-convert "$book" "$(basename "$book" .epub).mobi"
VALUE=$(calibredb add basename "$book" --with-library=~/calibre-library)
ID=$(echo $VALUE | cut -d':' -f 2)
calibredb add_format $ID "$(basename "$book" .epub).mobi" --with-library=~/calibre-library
done

rm *.epub *.mobi
sudo systemctl restart calibre.service

run it via cron

Last edited by sdblepas; 11-04-2018 at 06:29 AM.
sdblepas is offline   Reply With Quote