My OPDS library

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:

Install Calibre

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.

Install and configure Calibre2opds

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:

  1. Set “Database folder” to the root of your Calibre library directory.
  2. Leave “Destination folder” blank.
  3. 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.

Once this is done, you will have a HTML catalog you can browse:

Install and configure FBReader

  1. Install FBReader from Android Market and open it.
  2. Press the Menu key, then select “Network library
  3. Press the Menu key, then select “Add catalog”
  4. Select “Enter URL manually”
  5. Enter the URL to your library, appended with “_catalog/index.xml”. For example, “http://www.example.com/my_personal_library/_catalog/index.xml”.
  6. 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.

Tags: , ,

  1. RP’s avatar

    Can you see an advantage/disadvantage in using “calibre2opds”, instead of installing calibre and using it’s built in opds compatible content server along with apache?

    http://manual.calibre-ebook.com/server.html

    I’m considering using “owncloud” along with the calibre content server.

    Reply

    1. Tyler Wagner’s avatar

      Owncloud is cool. :)

      The difference, aside from the appearance of the pages, is that using Calibre’s content server requires supporting a running instance of Calibre on your web server. Using Calibre2opds, you get html and xml. You don’t need python or any of Calibre’s dependencies. You don’t have to ensure that Calibre is or remains running. I have nothing against python, but I don’t think installing a GUI on a server is a good idea.

      Reply

    2. Felix’s avatar

      Great tutorial! But you actually keep your library in two places?

      I used to use Calibre + Calibre OPDS, but the setup is bit complicated and regenerating the catalog every time manually is annoying. So I end up with a simple Web service I programmed, catalog.im. It helps me to organize all my ebook collections and it gives a up-to-date OPDS feed. All I need to do is to upload my ebooks, and these ebooks will appear in the library and the OPDS feed.

      I would like to invite you to try it out :D

      OK, I admit, it’s a promotion :ashamed:

      Reply

      1. Tyler Wagner’s avatar

        I don’t mind the promotion, but this is a cloud service. The point of my solution is to store my books myself, on my infrastructure. I look forward to you releasing the source behind catalog.im, so we can do the same.

        I use an rsync script to push my library from my local device to my web server. I’d be quite happy if Calibre had a web-based front end that didn’t require me running X on the server.

        Reply

      2. Liliana’s avatar

        I’m amazed, I have to admit. Seldom do I come across a blog that’s
        both educative and interesting, and without a doubt, you have hit
        the nail on the head. The problem is something
        that too few men and women are speaking intelligently
        about. I am very happy that I came across this in my search
        for something concerning this.

        Reply

      3. Sébastien’s avatar

        If you really like Calibre but doesn’t trust any cloud service, you can host your own Calibre catalog in your own webserver (on your Nas or elsewhere). That’s why I coded COPS (Calibre OPDS PHP Server)

        You can get more information and see a demo here : https://blog.slucas.fr/en/oss/calibre-opds-php-server

        Of course if you don’t have a webserver, dropbox is the way to go.

        Reply

        1. Tyler Wagner’s avatar

          That is slick, Sébastien. Especially the search feature. I’ll give it a test on my own library.

          This effectively skips steps 2 and 4 above, and means I only have to run Calibre, then sync its Calibre’s files.

          Reply

Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">