View Single Post
Old 09-06-2015, 12:10 AM   #7
eschwartz
Ex-Helpdesk Junkie
eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.eschwartz ought to be getting tired of karma fortunes by now.
 
eschwartz's Avatar
 
Posts: 19,421
Karma: 85400180
Join Date: Nov 2012
Location: The Beaten Path, USA, Roundworld, This Side of Infinity
Device: Kindle Touch fw5.3.7 (Wifi only)
Quote:
Originally Posted by eschwartz View Post
calibre's Auto-add folder on the server only works if you have the calibre GUI running (headless).

I suggest exporting books to a temporary folder on the server (shared over NAS) and using a cron/systemd job backed by inotify to add all books added to that folder, and clean them up afterward.

calibre has many useful CLI tools you probably want `calibredb restore_database` to fix the remote library, and `calibredb add --one-book-per-directory` to add books exported from calibre on your Mac.
What I would suggest doing, again, is cleaning up the books the way you want it on your Mac, then using Save-to-disk to save them in one-book-per-folder layout.
Save them inside a folder on your server, e.g. /tmp/calibre-intake/

Then adding them to your linux server using the CLI as I said above.
Code:
calibredb add -r --one-book-per-directory /tmp/calibre-intake/
rm -rf /path/to/ebook-folder/*
You can automate that in a script, which uses inotify to tell when the /tmp/calibre-intake/ folder changes:
Code:
while inotifywait -e create /tmp/calibre-intake; do
    calibredb add -r --one-book-per-directory /tmp/calibre-intake/
    rm -rf /tmp/calibre-intake/*
done
You can also convert that to a system service (now I think about it, NOT as a cron job). How to do this will depend on what init system your server uses.

Last edited by eschwartz; 09-06-2015 at 12:12 AM.
eschwartz is offline   Reply With Quote