View Single Post
Old 12-01-2012, 05:18 AM   #11
chaley
"chaley", not "charley"
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 5,446
Karma: 831552
Join Date: Jan 2010
Location: France
Device: Many android devices
Another way to handle the problem using a script is to use the environment variables CALIBRE_OVERRIDE_DATABASE_PATH and CALIBRE_CONFIG_DIRECTORY. Put the library on dropbox or what-have-you. Have the script that your assistant uses to start calibre copy the metadata.db file from the library to some tmp file. Put the name of that tmp file into the CALIBRE_OVERRIDE_DATABASE_PATH variable. Set up a calibre configuration folder somewhere and point at it with CALIBRE_CONFIG_DIRECTORY.

The reason for CALIBRE_CONFIG_DIRECTORY: to prevent opening the library if calibre is started without using the script. The default config would point at an empty library somewhere.

The reason for CALIBRE_OVERRIDE_DATABASE_PATH: calibre opens the database read/write. If it opens the "real" db then the transport you are using (dropbox etc) will attempt to copy the db back to the cloud, probably creating conflicts. Opening a copy of the DB elsewhere prevents that, and also minimizes problems if you make changes while your assistant has calibre open.

Whether or not the library in dropbox (or whatever) is the master is up to you. In your case I might consider making a copy from the master from time to time just to avoid having your assistant accidentally modify or delete books from the library. These operations operate on the file system and thus will be reflected back to the "master" copy.

I use CALIBRE_OVERRIDE_DATABASE_PATH to keep a headless server up to date. A monitor (monit on linux) watches the timestamp of metadata.db in the dropbox library copy. If it changes, then the monitor restarts the calibre server. The server startup script makes a copy of metadata.db in /tmp and uses that to serve books. No collisions. Changes in the library are reflected on the web within minutes of the change.

I use CALIBRE_CONFIG_DIRECTORY on my library computer to permit me to have different configurations for different libraries (production, development, test, etc).
chaley is offline   Reply With Quote