View Single Post
Old 02-16-2011, 02:03 AM   #1
kiwidude
calibre/Sigil Developer
kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.kiwidude ought to be getting tired of karma fortunes by now.
 
Posts: 4,220
Karma: 1333994
Join Date: Oct 2010
Location: London, UK
Device: Kindle Paperwhite 3G, iPad 3, iPad Air
[Metadata Download Plugin] Goodreads Metadata **Deprecated**

As of Calibre 0.8 this plugin is deprecated and will no longer work. Instead you should use the replacement Goodreads Metadata Source plugin which is compatible with Calibre 0.8 onwards.

This plugin allows Calibre to read book information from goodreads.com when you choose to download/fetch metadata. Calibre currently comes with plugins for a number of information sources such as Amazon and Googlebooks. Adding this plugin can potentially increase both the success rate and quality of information retrieved for some of your books.

It is the first of a Goodreads trinity of plugins I will publish in this forum. The other two are for Goodreads cover downloads and shelve syncing.

Main Features of v1.3.3
  • Can retrieve title, author, series, isbn, comments, publisher, publication date and tags
  • Does not require the ISBN of a book to retrieve metadata, provided both title and author are specified for your Calibre book. In that circumstance it will do a Goodreads title/author search matching with the first result found if any.
  • Publication date is the "first published" date where available. This is brilliant for users like me who just want a "date the author wrote it" for sorting purposes rather than "date this particular ISBN edition was published" that other metadata sources provide. In a future version I will make this configurable.
  • Tags are created by a mapping between the most popular shelves a book is on and my own hard-coded subset of tag names. You can see the popular shelves on the lower right of the book detail web page on Goodreads. In a future version this may be configurable. For now if you see a popular shelf name listed that is not below for a book you want a particular tag for let me know. Below is the current mappings - Goodreads shelf name on the left, one or more Calibre tags it will map to on the right.
    Spoiler:
    Code:
    calibre_tag_lookup = {
                    'Anthologies': 'Anthologies',
                    'Adventure': 'Adventure',
                    'Adult Fiction': 'Adult',
                    'Adult': 'Adult',
                    'Art': 'Art',
                    'Biography': 'Biography',
                    'Biography Memoir': 'Biography',
                    'Business': 'Business',
                    'Chick-lit': 'Chick-lit',
                    'Childrens': 'Childrens',
                    'Classics': 'Classics',
                    'Comics': 'Comics',
                    'Graphic Novels Comics': 'Comics',
                    'Contemporary': 'Contemporary',
                    'Cookbooks': 'Cookbooks',
                    'Crime': 'Crime',
                    'Fantasy': 'Fantasy',
                    'Feminism': 'Feminism',
                    'Gardening': 'Gardening',
                    'Gay': 'Gay',
                    'Glbt': 'Gay',
                    'Health': 'Health',
                    'History': 'History',
                    'Historical Fiction': 'Historical',
                    'Horror': 'Horror',
                    'Comedy': 'Humour',
                    'Humor': 'Humour',
                    'Health': 'Health',
                    'Inspirational': 'Inspirational',
                    'Sequential Art > Manga': 'Manga',
                    'Modern': 'Modern',
                    'Music': 'Music',
                    'Mystery': 'Mystery',
                    'Non Fiction': 'Non-Fiction',
                    'Paranormal': 'Paranormal',
                    'Religion': 'Religion',
                    'Philosophy': 'Philosophy',
                    'Politics': 'Politics',
                    'Poetry': 'Poetry',
                    'Psychology': 'Psychology',
                    'Reference': 'Reference',
                    'Romance': 'Romance',
                    'Science': 'Science',
                    'Science Fiction': 'Science Fiction',
                    'Science Fiction Fantasy': 'Science Fiction,Fantasy',
                    'Self Help': 'Self Help',
                    'Sociology': 'Sociology',
                    'Spirituality': 'Spirituality',
                    'Suspense': 'Suspense',
                    'Thriller': 'Thriller',
                    'Travel': 'Travel',
                    'Paranormal > Vampires': 'Vampires',
                    'War': 'War',
                    'Western': 'Western',
                    'Language > Writing': 'Writing',
                    'Writing > Essays': 'Writing',
                    'Young Adult': 'Young Adult',
                    }

Special Notes:
  • This plugin uses web page scraping to retrieve the data from Goodreads. I've tried to cover as many scenarios as I have found to date but there could be some I've missed. If the data is missing or doesn't match what you would expect from looking at the Goodreads book web page, post all the details including the URL and I will take a look.
  • Series information from Goodreads can sometimes be a range for an omnibus/boxset version such as "Harry Potter #1-7". In this circumstance it will assign it the first number in the range specified of "Harry Potter [1]" in Calibre. In a future version this may be configurable, for those of you who put omnibus versions at 0 or 99 for instance.
  • Kovid intends in future to make changes to the API for metadata download plugins to improve the functionality and performance. When he publishes that new version, this plugin may stop working. Check back here for updates over the next few months.

Installation Notes:
  • Download the attached zip file and install the plugin as described in the Introduction to plugins thread.
  • Note that this is not a GUI plugin so it is not intended/cannot be added to context menus/toolbars etc.
  • You can enable/disable and configure both it and the other metadata download plugins like Amazon, Google Books etc in Preferences -> Plugins -> Metadata download plugins

Version History:
Spoiler:
Version 1.3.3 - 18 Apr 2011
Fix a typo in the Anthologies tag mapping, remove action-adventure legacy mapping.

Version 1.3.2 - 16 Apr 2011
And yet another change to the website by Goodreads that broke tags again.

Version 1.3.1 - 13 Apr 2011
Fix for yet another website update by Goodreads that broke tags again.

Version 1.3 - 13 Apr 2011
Change the URL searched against as Goodreads have changed their website.
Change all the tag mappings as Goodreads no long has Popular Shelves and has Genres instead.

Version 1.2.1 - 28 Feb 2011
Re-release of 1.1.3 due to incorrect version numbering of earlier release.

Version 1.1.3 - 22 Mar 2011
Return [] for results when no isbn match or no title match
Strip anything in brackets off the title before doing search

Version 1.1.2 - 07 Mar 2011
For compatibility with Calibre v0.7.48 return [] instead of None when no tags for a book.
Changed mapping for historical-fiction to Historical instead of History,Fiction

Version 1.1.1 - 01 Mar 2011
Additional tag mappings as per StevieRaveOn post #12

Version 1.1 - 28 Feb 2011
Fix for scraping rating value with international numeric machine settings
Addition of a horror->Horror and non-fiction->Non-Fiction tag mappings
Change fiction/general-fiction tag mappings from General to Fiction

Version 1.0 - 16 Feb 2011
Initial release of Goodreads Metadata plugin

Thanks due to stormcloude for testing and requesting me to put together a working version based on an earlier attempt by tmcone on this ticket.
Attached Files
File Type: zip Goodreads Metadata.zip (21.2 KB, 11229 views)

Last edited by kiwidude; 05-06-2011 at 06:37 PM. Reason: Plugin deprecated message
kiwidude is offline   Reply With Quote