Douban provider for Alexandria

Fri 30 April 2010
  • ANN tags:
  • Douban
  • foss
  • gnome
  • ruby published: true comments: true

Alexandra is a desktop book collection manager on gnome written in ruby. With an extensible architecture, Alexandria uses different sources to retrieve book's data, including Amazon and many local sites.

Douban.com is considered to be most applicable data source for books published in Chinese. So I write this provider according to Alexandria's SPI. Now it's possible to add Chinese books and manage reading lists.

alexandria

Now the code can be found in Alexandria's bug tracker: http://rubyforge.org/tracker/index.php?func=detail&aid=28160&group_id=205&atid=865

However, the patch file of book_providers.rb in that list is for svn trunk head version only. To use it with currently stable version of Ubuntu, first, make sure you have Alexandria version 0.6.5-0ubuntu1 and libjson-ruby1.8 installed.

Download douban.rb from rubyforge: http://rubyforge.org/tracker/download.php/205/865/28160/4923/douban.rb Copy the file to /usr/lib/ruby/1.8/alexandria/book_providers/ with super user privileges.
Use this patch to /usr/lib/ruby/1.8/alexandria/book_providers.rb
[cc lang="ruby"]
310a311,323 < begin < begin < require 'json' < rescue LoadError < require 'rubygems' < require 'json' < end < require 'alexandria/book_providers/douban' < rescue LoadError =< ex < log.error{ex} < log.warn {'Fail to load douban as provider'} < end <
[/cc]

Feel free to report issue here.