View Single Post
Old 01-31-2013, 02:03 PM   #8
Halo
Connoisseur
Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.Halo did not drink the Kool Aid.
 
Halo's Avatar
 
Posts: 96
Karma: 72130
Join Date: Nov 2008
Location: San Francisco Bay Area, CA, USA
Device: Sony PRS-505, Kindle DX 1st Gen, Kindle Fire 1st Gen
Hi everyone,

I found a solution for this that's working well for me. I'm posting a follow-up so others can try this if they like. It's a bit technical, but if you are using Linux or Mac then this should work for you. So far, I am very happy with the results.

I created a new user on my computer called 'calibre' and installed calibre into /home/calibre/calibre. Then I created a directory called 'library'. In this example my main calibre library is located at /srv/fileshare/Ebooks/Library. I will make a copy of my calibre library to /home/calibre/library which will be used by the calibre content server.

First, make sure the directory for the content server library is empty. You can skip this step the first time you set up your library and content server. Be careful with this command! It removes all files in the directory including all sub-directories. This is one reason that I created a new user called 'calibre' just for the content server. Doing that restricts changes to the 'calibre' user and protects other files on my computer from accidental deletion including the original calibre library.

Code:
rm /home/calibre/library/* -rf
Next, I copy my main calibre library from my file share directory into the newly created library directory that will be used by the content server. I am using the -s option for cp which will create links in the destination that point back to the original files. When I access a file in my content server library, the computer will really read the original file from my main calibre library. This will save disk space on my server since it doesn't have to duplicate every file. The -a option stands for "Archive" and makes sure that the destination creates sub-directories and sets the correct time and date on the destination files (links) among other things.

Code:
cp -as /srv/fileshare/Ebooks/Library/* /home/calibre/library/
Now I remove the links to the database files. We'll make real copies of the files in the next step.

Code:
rm /home/calibre/library/metadata.db
rm /home/calibre/library/metadata_db_prefs_backup.json
We need to copy the actual files for the database rather than create links. This is needed because the content server must be able to write to the database files.

Code:
cp /srv/fileshare/Ebooks/Library/metadata.db /home/calibre/library/
cp /srv/fileshare/Ebooks/Library/metadata_db_prefs_backup.json /home/calibre/library/
The library for the content server is ready. Start up the content server.

Code:
/home/calibre/calibre/calibre-server --with-library /home/calibre/library/ --max-cover=200x266 --daemonize
That's it! Now the content server will serve your books, but it will not interfere with your access of the main library by the main program. If you make changes to the main library, just stop the content server process, run all of the commands in this post from top to bottom, and you will be back in business.
Halo is offline   Reply With Quote