From 33b8feb4bf55f3c79679251731691d151a292db6 Mon Sep 17 00:00:00 2001 From: John Schember Date: Sun, 12 Jun 2011 11:53:35 -0400 Subject: [PATCH 1/4] Store: Fix Amazon plugin, listing of books uses old style vertical list for some search terms. --- src/calibre/gui2/store/amazon_plugin.py | 26 ++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/src/calibre/gui2/store/amazon_plugin.py b/src/calibre/gui2/store/amazon_plugin.py index a9ec17e694..693ef883fb 100644 --- a/src/calibre/gui2/store/amazon_plugin.py +++ b/src/calibre/gui2/store/amazon_plugin.py @@ -139,14 +139,26 @@ class AmazonKindleStore(StorePlugin): cover_xpath = './/div[@class="productTitle"]//img/@src' title_xpath = './/div[@class="productTitle"]/a//text()' price_xpath = './/div[@class="newPrice"]/span/text()' - # Vertical list of books. Search "martin" + # Vertical list of books. else: - data_xpath = '//div[contains(@class, "results")]//div[contains(@class, "result")]' - format_xpath = './/span[@class="binding"]//text()' - asin_xpath = './/div[@class="image"]/a[1]' - cover_xpath = './/img[@class="productImage"]/@src' - title_xpath = './/a[@class="title"]/text()' - price_xpath = './/span[@class="price"]/text()' + # New style list. Search "Paolo Bacigalupi" + if doc.xpath('boolean(//div[@class="image"])'): + data_xpath = '//div[contains(@class, "results")]//div[contains(@class, "result")]' + format_xpath = './/span[@class="binding"]//text()' + asin_xpath = './/div[@class="image"]/a[1]' + cover_xpath = './/img[@class="productImage"]/@src' + title_xpath = './/a[@class="title"]/text()' + price_xpath = './/span[@class="price"]/text()' + # Old style list. Search "martin" + else: + data_xpath = '//div[contains(@class, "result")]' + format_xpath = './/span[@class="format"]//text()' + asin_xpath = './/div[@class="productImage"]/a[1]' + cover_xpath = './/div[@class="productImage"]//img/@src' + title_xpath = './/div[@class="productTitle"]/a/text()' + price_xpath = './/div[@class="newPrice"]//span//text()' + + for data in doc.xpath(data_xpath): if counter <= 0: From 7d44fed9e47b4e17ecfa84211e76ebf875d20911 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 12 Jun 2011 10:03:00 -0600 Subject: [PATCH 2/4] ... --- src/calibre/manual/conversion.rst | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/calibre/manual/conversion.rst b/src/calibre/manual/conversion.rst index 540da0fc9a..fea828f706 100644 --- a/src/calibre/manual/conversion.rst +++ b/src/calibre/manual/conversion.rst @@ -189,7 +189,7 @@ Extra CSS This option allows you to specify arbitrary CSS that will be applied to all HTML files in the input. This CSS is applied with very high priority and so should override most CSS present in -the input document itself. You can use this setting to fine tune the presentation/layout of your +the **input document** itself. You can use this setting to fine tune the presentation/layout of your document. For example, if you want all paragraphs of class `endnote` to be right aligned, just add:: @@ -200,7 +200,8 @@ or if you want to change the indentation of all paragraphs:: p { text-indent: 5mm; } :guilabel:`Extra CSS` is a very powerful option, but you do need an understanding of how CSS works -to use it to its full potential. +to use it to its full potential. You can use the debug pipeline option described above to see what +CSS is present in your input document. Miscellaneous ~~~~~~~~~~~~~~ From c1c5c8e676055ba8a91fdcd346d530e750d67635 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 12 Jun 2011 10:12:12 -0600 Subject: [PATCH 3/4] ... --- src/calibre/gui2/device.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index 9f71c3088d..c9c79095f3 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -597,7 +597,7 @@ class DeviceMenu(QMenu): # {{{ # }}} -class DeviceSignals(QObject): +class DeviceSignals(QObject): # {{{ #: This signal is emitted once, after metadata is downloaded from the #: connected device. #: The sequence: gui.device_manager.is_device_connected will become True, @@ -614,6 +614,7 @@ class DeviceSignals(QObject): device_connection_changed = pyqtSignal(object) device_signals = DeviceSignals() +# }}} class DeviceMixin(object): # {{{ From ba2b3f05bd58447e4a122d4cd52b15ca8bfef3e5 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 12 Jun 2011 10:24:54 -0600 Subject: [PATCH 4/4] Database: Explicitly test for case sensitivity on OS X instead of assuming a case insensitive filesystem. Fixes #796258 (Various file management functions/integrity checks broken on case sensitive OSX) --- src/calibre/library/database2.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py index 03c0712daa..926ac5527c 100644 --- a/src/calibre/library/database2.py +++ b/src/calibre/library/database2.py @@ -26,7 +26,7 @@ from calibre.library.custom_columns import CustomColumns from calibre.library.sqlite import connect, IntegrityError from calibre.library.prefs import DBPrefs from calibre.ebooks.metadata.book.base import Metadata -from calibre.constants import preferred_encoding, iswindows, isosx, filesystem_encoding +from calibre.constants import preferred_encoding, iswindows, filesystem_encoding from calibre.ptempfile import PersistentTemporaryFile from calibre.customize.ui import run_plugins_on_import from calibre import isbytestring @@ -188,8 +188,9 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns): apply_default_prefs = not os.path.exists(self.dbpath) self.connect() - self.is_case_sensitive = not iswindows and not isosx and \ - not os.path.exists(self.dbpath.replace('metadata.db', 'MeTAdAtA.dB')) + self.is_case_sensitive = (not iswindows and + not os.path.exists(self.dbpath.replace('metadata.db', + 'MeTAdAtA.dB'))) SchemaUpgrade.__init__(self) # Guarantee that the library_id is set self.library_id