diff --git a/src/calibre/gui2/store/manybooks_plugin.py b/src/calibre/gui2/store/manybooks_plugin.py index aa5c45300a..57eb42c13e 100644 --- a/src/calibre/gui2/store/manybooks_plugin.py +++ b/src/calibre/gui2/store/manybooks_plugin.py @@ -90,5 +90,6 @@ class ManyBooksStore(BasicStoreConfig, StorePlugin): s.price = price.strip() s.detail_item = '/titles/' + id s.drm = SearchResult.DRM_UNLOCKED + s.formts = 'EPUB, PDB (eReader, PalmDoc, zTXT, Plucker, iSilo), FB2, ZIP, AZW, MOBI, PRC, LIT, PKG, PDF, TXT, RB, RTF, LRF, TCR, JAR' yield s diff --git a/src/calibre/gui2/store/mobileread_plugin.py b/src/calibre/gui2/store/mobileread_plugin.py index 3ac035d378..56fcb207bf 100644 --- a/src/calibre/gui2/store/mobileread_plugin.py +++ b/src/calibre/gui2/store/mobileread_plugin.py @@ -104,8 +104,8 @@ class MobileReadStore(BasicStoreConfig, StorePlugin): for book_data in data.xpath('//ul/li'): book = BookRef() book.detail_item = ''.join(book_data.xpath('.//a/@href')) - book.format = ''.join(book_data.xpath('.//i/text()')) - book.format = book.format.strip() + book.formats = ''.join(book_data.xpath('.//i/text()')) + book.formats = book.formats.strip() text = ''.join(book_data.xpath('.//a/text()')) if ':' in text: @@ -222,7 +222,7 @@ class BooksModel(QAbstractItemModel): self.books = [] if self.filter: for b in self.all_books: - test = '%s %s %s' % (b.title, b.author, b.format) + test = '%s %s %s' % (b.title, b.author, b.formats) test = test.lower() include = True for item in self.filter.split(' '): @@ -275,7 +275,7 @@ class BooksModel(QAbstractItemModel): elif col == 1: return QVariant(result.author) elif col == 2: - return QVariant(result.format) + return QVariant(result.formats) return NONE def data_as_text(self, result, col): @@ -285,7 +285,7 @@ class BooksModel(QAbstractItemModel): elif col == 1: text = result.author elif col == 2: - text = result.format + text = result.formats return text def sort(self, col, order, reset=True): diff --git a/src/calibre/gui2/store/open_library_plugin.py b/src/calibre/gui2/store/open_library_plugin.py index 2bd38aae4f..0e2fa4b14f 100644 --- a/src/calibre/gui2/store/open_library_plugin.py +++ b/src/calibre/gui2/store/open_library_plugin.py @@ -71,3 +71,12 @@ class OpenLibraryStore(BasicStoreConfig, StorePlugin): s.drm = SearchResult.DRM_UNKNOWN yield s + + def get_details(self, search_result, timeout): + url = 'http://openlibrary.org/' + + br = browser() + with closing(br.open(url_slash_cleaner(url + search_result.detail_item), timeout=timeout)) as nf: + idata = html.fromstring(nf.read()) + search_result.formats = ', '.join(list(set(idata.xpath('//a[contains(@title, "Download")]/text()')))) + return True diff --git a/src/calibre/gui2/store/search.py b/src/calibre/gui2/store/search.py index 193ebbc420..d5fbe19e93 100644 --- a/src/calibre/gui2/store/search.py +++ b/src/calibre/gui2/store/search.py @@ -559,22 +559,22 @@ class Matches(QAbstractItemModel): return QVariant(self.DRM_UNKNOWN_ICON) elif role == Qt.ToolTipRole: if col == 1: - return QVariant(result.title) + return QVariant('

%s

' % result.title) elif col == 2: - return QVariant(result.author) + return QVariant('

%s

' % result.author) elif col == 3: - return QVariant(_('Detected price as: %s. Check with the store before making a purchase to verify this price information is correct.') % result.price) + return QVariant('

' + _('Detected price as: %s. Check with the store before making a purchase to verify this price is correct. This price often does not include promotions the store may be running.') % result.price + '

') elif col == 4: if result.drm == SearchResult.DRM_LOCKED: - return QVariant(_('This book as been detected as having DRM restrictions. This book may not work with your reader and you will have limitations placed upon you as to what you can do with this book. Check with the store before making any purchases to ensure you can actually read this book.')) + return QVariant('

' + _('This book as been detected as having DRM restrictions. This book may not work with your reader and you will have limitations placed upon you as to what you can do with this book. Check with the store before making any purchases to ensure you can actually read this book.') + '

') elif result.drm == SearchResult.DRM_UNLOCKED: - return QVariant(_('This book has been detected as being DRM Free. You should be able to use this book on any device provided it is in a format calibre supports for conversion. However, before making a purchase double check the DRM status with the store. The store may not be disclosing the use of DRM.')) + return QVariant('

' + _('This book has been detected as being DRM Free. You should be able to use this book on any device provided it is in a format calibre supports for conversion. However, before making a purchase double check the DRM status with the store. The store may not be disclosing the use of DRM.') + '

') else: - return QVariant(_('The DRM status of this book could not be determined. There is a very high likelihood that this book is actually DRM restricted.')) + return QVariant('

' + _('The DRM status of this book could not be determined. There is a very high likelihood that this book is actually DRM restricted.') + '

') elif col == 5: - return QVariant(result.store_name) + return QVariant('

%s

' % result.store_name) elif col == 6: - return QVariant(result.formats) + return QVariant('

%s

' % result.formats) elif role == Qt.SizeHintRole: return QSize(64, 64) return NONE diff --git a/src/calibre/gui2/store/smashwords_plugin.py b/src/calibre/gui2/store/smashwords_plugin.py index 43efe549cc..f91d5d09f3 100644 --- a/src/calibre/gui2/store/smashwords_plugin.py +++ b/src/calibre/gui2/store/smashwords_plugin.py @@ -93,3 +93,11 @@ class SmashwordsStore(BasicStoreConfig, StorePlugin): s.drm = SearchResult.DRM_UNLOCKED yield s + def get_details(self, search_result, timeout): + url = 'http://www.smashwords.com/' + + br = browser() + with closing(br.open(url + search_result.detail_item, timeout=timeout)) as nf: + idata = html.fromstring(nf.read()) + search_result.formats = ', '.join(list(set(idata.xpath('//td//b//text()')))) + return True