From be026b8d2bf56f1878b7de275c2e5df45a55231f Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Tue, 14 Jun 2011 23:14:00 -0300 Subject: [PATCH 1/5] KTouch - Image file names have changed - fix display of covers --- src/calibre/devices/kobo/driver.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 04fb3c37b0..1efce88f27 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -85,6 +85,16 @@ class KOBO(USBMS): except: self.fwversion = 'unknown' + # Determine Hardware version differences + product_id = self.detected_device.idProduct + debug_print ("device: ", product_id) + if product_id == 0x4161: #Original and KWifi + image_suffix = ' - NickelBookCover.parsed' + else: #KTouch + image_suffix = ' - N3_LIBRARY_FULL.parsed' + + debug_print("Image Suffix: ", image_suffix) + if self.fwversion != '1.0' and self.fwversion != '1.4': self.has_kepubs = True debug_print('Version of firmware: ', self.fwversion, 'Has kepubs:', self.has_kepubs) @@ -125,8 +135,9 @@ class KOBO(USBMS): if idx is not None: bl_cache[lpath] = None if ImageID is not None: - imagename = self.normalize_path(self._main_prefix + '.kobo/images/' + ImageID + ' - NickelBookCover.parsed') + imagename = self.normalize_path(self._main_prefix + '.kobo/images/' + ImageID + image_suffix) #print "Image name Normalized: " + imagename + if imagename is not None: bl[idx].thumbnail = ImageWrapper(imagename) if (ContentType != '6' and MimeType != 'Shortcover'): From c9d34ca631a564b1d78c18b9b905ce30c7f662d6 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Tue, 14 Jun 2011 23:23:32 -0300 Subject: [PATCH 2/5] KTouch - Image file names have changed - fix deleting images --- src/calibre/devices/kobo/driver.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 1efce88f27..25ef30edbd 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -297,7 +297,7 @@ class KOBO(USBMS): path_prefix = '.kobo/images/' path = self._main_prefix + path_prefix + ImageID - file_endings = (' - iPhoneThumbnail.parsed', ' - bbMediumGridList.parsed', ' - NickelBookCover.parsed',) + file_endings = (' - iPhoneThumbnail.parsed', ' - bbMediumGridList.parsed', ' - NickelBookCover.parsed', ' - N3_LIBRARY_FULL.parsed', ' - N3_LIBRARY_GRID.parsed', ' - N3_LIBRARY_LIST.parsed', ' - N3_SOCIAL_CURRENTREAD.parsed',) for ending in file_endings: fpath = path + ending From e8b723fb9900d8e9e448caf641cc1a6f5c220768 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Wed, 15 Jun 2011 21:53:40 -0300 Subject: [PATCH 3/5] KTouch - Image file names have changed - modify fix for display of covers --- src/calibre/devices/kobo/driver.py | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 25ef30edbd..6076aa35eb 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -85,16 +85,6 @@ class KOBO(USBMS): except: self.fwversion = 'unknown' - # Determine Hardware version differences - product_id = self.detected_device.idProduct - debug_print ("device: ", product_id) - if product_id == 0x4161: #Original and KWifi - image_suffix = ' - NickelBookCover.parsed' - else: #KTouch - image_suffix = ' - N3_LIBRARY_FULL.parsed' - - debug_print("Image Suffix: ", image_suffix) - if self.fwversion != '1.0' and self.fwversion != '1.4': self.has_kepubs = True debug_print('Version of firmware: ', self.fwversion, 'Has kepubs:', self.has_kepubs) @@ -135,7 +125,11 @@ class KOBO(USBMS): if idx is not None: bl_cache[lpath] = None if ImageID is not None: - imagename = self.normalize_path(self._main_prefix + '.kobo/images/' + ImageID + image_suffix) + imagename = self.normalize_path(self._main_prefix + '.kobo/images/' + ImageID + ' - NickelBookCover.parsed') + if not os.path.exists(imagename): + # Try the Touch version if the image does not exist + imagename = self.normalize_path(self._main_prefix + '.kobo/images/' + ImageID + ' - N3_LIBRARY_FULL.parsed') + #print "Image name Normalized: " + imagename if imagename is not None: From cb66ec304d43609281fe93242b557e018816f568 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Wed, 15 Jun 2011 22:17:52 -0300 Subject: [PATCH 4/5] KTouch - Hide the internal help files that don't exist on the device storage --- src/calibre/devices/kobo/driver.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 6076aa35eb..978a848707 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -199,7 +199,9 @@ class KOBO(USBMS): changed = False for i, row in enumerate(cursor): # self.report_progress((i+1) / float(numrows), _('Getting list of books on device...')) - + if row[3].startswith("file:///usr/local/Kobo/help/"): + # These are internal to the Kobo device and do not exist + continue path = self.path_from_contentid(row[3], row[5], row[4], oncard) mime = mime_type_ext(path_to_ext(path)) if path.find('kepub') == -1 else 'application/epub+zip' # debug_print("mime:", mime) From 515bc88d595c93c47912e47eb26d2805c21ce163 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Wed, 15 Jun 2011 22:31:12 -0300 Subject: [PATCH 5/5] KTouch - Why oh why does the content id keep changing format? --- src/calibre/devices/kobo/driver.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 978a848707..e606f65e38 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -457,7 +457,10 @@ class KOBO(USBMS): path = self._main_prefix + path + '.kobo' # print "Path: " + path elif (ContentType == "6" or ContentType == "10") and MimeType == 'application/x-kobo-epub+zip': - path = self._main_prefix + '.kobo/kepub/' + path + if path.startswith("file:///mnt/onboard/"): + path = self._main_prefix + path.replace("file:///mnt/onboard/", '') + else: + path = self._main_prefix + '.kobo/kepub/' + path # print "Internal: " + path else: # if path.startswith("file:///mnt/onboard/"):