View Single Post
Old 11-16-2009, 05:40 AM   #1
dpierron
calibre2opds guru
dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.dpierron shines like a glazed doughnut.
 
dpierron's Avatar
 
Posts: 533
Karma: 8792
Join Date: Aug 2005
Location: Metz, France
Device: iPhone, iPad, PRS-650
Thumbs up [Old Thread] Calibre + Dropbox = unclouded happiness

NEW The tool is now called calibre2opds and it has its own website, and thread here on MobileRead...

NEW I programmed a tool based on Calibre2Web that can be used on all platforms (Windows, Macs and Unixes) to generate the Stanza catalogs.

It is hosted on Sourceforge and I intend on updating it often, so please join the project and make requests !

-------------------------------------------


I'm pretty sure a lot of people here know Dropbox, the (free at first) file sharing and synchronization service...

I use it to sync the files on my two Macs, and my work PC ; it's a very easy to use and efficient service.

Recently, I began syncing my Calibre library, so the books I edit/add/remove on either machine would be available on all the others ; Calibre is a multi-platform marvel, so this syncing makes a lot of sense.

And I thought of something : if I generate the stanza.xml file from the Calibre database (using the calibre-db command), maybe it could be automatically accessible from my iPhone, now that the whole Calibre library is synchronized and available on my Dropbox account ?

Guess what ? It works ! Unfortunately, it's still a manual process, but I'm pretty sure it could be possible for our generous Kovid to change it into something automatic...

Here are the steps needed to make this happen :
  1. Publish your Calibre library in a directory of the Public part in your Dropbox account

    The library must be in a public part of your Dropbox account, because you will need the URL to the stanza.xml file in the last step. If you do not want to make it public, you will still be able to browse your (private) dropbox account website from inside Stanza, but it's another story...

    To get the URL to your Calibre library, simply right-click on a file in the folder and select "Copy public link" from the "Dropbox" menu ; let's call this URLTOSHAREDCALIBRELIBRARY : mine is http://dl.dropbox.com/u/788541/calib...ary/stanza.xml (fake number, of course).

  2. export the Calibre database into a stanza.xml file
    We need to use the calibredb program, located in the Calibre program folder ; find out the path to this file ; let's call it PATHTOCALIBREDB (use french quotes around it if there are spaces in it) : mine is "c:\Program Files\Calibre2\calibredb.exe".

    Then, we need the path to the Calibre library folder ; let's call it CALIBRELIBRARYFOLDER (again, use french quotes around it if there are spaces in it) : mine is "c:\data\dropbox\My Dropbox\Public\calibre_library"

    Here is the command used to generate the stanza.xml file :

    PATHTOCALIBREDB list --output-format stanza --prefix URLTOSHAREDCALIBRELIBRARY > CALIBRELIBRARYFOLDER\stanza.xml

    (replace the variables with the ones we discussed earlier)

    As an example, here is the command line I am using :

    "c:\Program Files\Calibre2\calibredb.exe" list --output-format stanza --prefix http://dl.getdropbox.com/u/788541/calibre_library > "c:\data\dropbox\My Dropbox\Public\calibre_library\stanza.xml"

  3. correct the stanza.xml file

    Some characters are encoded in a way that make Stanza frown : simply replace them using a plain text editor ; replace '%28' with '(' and '%29' with ')' (skip the quotes, obviously).

  4. configure your Stanza program to make it access your new online library

    In Stanza (on your iPhone for example), create a new online stanza catalog and enter the URL to your stanza.xml file ; this URL is URLTOSHAREDCALIBRELIBRARY/stanza.xml : mine is http://dl.dropbox.com/u/788541/calib...ary/stanza.xml.

That's all !

Of course, if the stanza.xml file could be generated automatically with every modification of the database, it would be even better, but even now it's very convenient...

Thanks again Kovid for Calibre, the Lexycle people for Stanza and Dropbox for being free...

PS : if I made a mistake in my explanation, or if something was not clear enough, ask questions and I'll be happy to try and explain better...

Last edited by dpierron; 03-09-2010 at 11:49 AM. Reason: Added calibredbxtract
dpierron is offline   Reply With Quote