Update 2014-04-25: This post has been superceded by my new method.
I have a personal server (tolaris.com), a large collection of eBooks, and several Android devices. I like to read books on the go, without the hassle of actually carrying dead trees. But I don’t want to manage local copies of ebooks on my phone or tablet. What I really want is a personal library, accessible anywhere, from which I can download my books at any time. And now I have that.
What you’ll need:
- Calibre, to manage your eBook library. Calibre is awesome. It supports all the formats you are likely to care about and can convert between them, and stores and manages your books in a way you can easily access with a file browser.
- Calibre2opds, which generates OPDS and HTML catalogs from the metadata of Calibre. OPDS is an interchangeable format for describing and sharing books – such as in a personal library.
- A personal server with an HTTP server, such as Apache. You can use a real server or a virtual machine as long as it has a public IP address you can access. Or you could use your desktop PC, accessible only within your private LAN when you’re at home. If you don’t want to run your own server, you could even use Dropbox.
- eBook software with OPDS support, such as FBReader. I read primarily on my Android devices, a Nook Color and an HTC Desire HD, both running community-built ROMs. You can get FBReader on the Market.
How to do it:
Calibre is easy to install (
apt-get install calibre on Ubuntu), and easy to use. I won’t cover it here. Install it, add some eBooks to your library, and close the application.
Calibre2opds supports both a GUI mode, which I use only to configure it, and a command-line mode, which is handy for updating your library from a script. Unfortunately, the CLI mode has been broken since 2.4-beta4, and isn’t expected to be fixed until the next major release. So I continue to use that release. The developers no longer provide 2.4-beta4, so download it here.
Unpack the zip file somewhere, and open a terminal. Run it for the first time:
Configure the following settings on the “Main options” tab:
- Set “Database folder” to the root of your Calibre library directory.
- Leave “Destination folder” blank.
- Uncheck “Copy Catalog to database folder”.
Now press “Save”, then “Generate catalogs”. This can take several minutes to complete if you have a large library.
If you have run Calibre2opds once and saved your settings, you can run it without the GUI using:
Upload to the server
Now upload your library and catalog to your server. If you run your own server you probably know how to do this. If not, see the Dropbox method above.
I use a simple script with
rsync to upload ~/Library to a private area of my web server. Here is a very simple script that you can run after you add new books to Calibre.
#!/bin/sh # if Calibre metadata is newer than the OPDS index, update the catalog if [ "$HOME/Library/metadata.db" -nt "$HOME/Library/index.xml" ] ; then cd ~/calibre2opds/ sh ./run.sh else echo "Calibre has not been run since last update, skipping calibre2opds." fi rsync -av --delete $HOME/Library/ firstname.lastname@example.org:~/public_html/my_personal_library/
Once this is done, you will have a HTML catalog you can browse:
Install and configure FBReader
- Install FBReader from Android Market and open it.
- Press the Menu key, then select “Network library
- Press the Menu key, then select “Add catalog”
- Select “Enter URL manually”
- Enter the URL to your library, appended with “_catalog/index.xml”. For example, “http://www.example.com/my_personal_library/_catalog/index.xml”.
- Press OK twice. Your catalog will now appear in the list.
You can now browse your catalog within FBReader, select any book, and download it, and read it without navigating out again.
If you are an iPhone user, consider MegaReader, available free in the App Store. Configuration is similar.
Updating the library
Once you have all this set up, updating your library is easy. Just add the book in Calibre, run calibre2opds, and sync the files to your server. It’ll be available in FBReader as soon as your access the network library.