From 710a4e232e62981802d5a3dec9a251d889bbf202 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Sat, 26 Jun 2010 18:32:08 -0300 Subject: [PATCH 1/2] Fix issue with images for files on SD card not being displayed --- 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 7a37cb19c9..d367cc251d 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -85,7 +85,7 @@ class KOBO(USBMS): idx = bl_cache.get(lpath, None) if idx is not None: - imagename = self.normalize_path(prefix + '.kobo/images/' + ImageID + ' - NickelBookCover.parsed') + imagename = self.normalize_path(self._main_prefix + '.kobo/images/' + ImageID + ' - NickelBookCover.parsed') #print "Image name Normalized: " + imagename bl[idx].thumbnail = ImageWrapper(imagename) bl_cache[lpath] = None From 3c59d2da7f1992e528e671c468ad805eef624d85 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Thu, 8 Jul 2010 22:14:34 -0300 Subject: [PATCH 2/2] Fix bug with html files not being displayed - Kobo does not generate an ImageID nad used a different ContentID format --- src/calibre/devices/kobo/books.py | 3 ++- src/calibre/devices/kobo/driver.py | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/calibre/devices/kobo/books.py b/src/calibre/devices/kobo/books.py index 781562d091..7ee5beaec0 100644 --- a/src/calibre/devices/kobo/books.py +++ b/src/calibre/devices/kobo/books.py @@ -54,7 +54,8 @@ class Book(MetaInformation): except: self.datetime = time.gmtime() - self.thumbnail = ImageWrapper(thumbnail_name) + if thumbnail_name is not None: + self.thumbnail = ImageWrapper(thumbnail_name) self.tags = [] if other: self.smart_update(other) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index d367cc251d..ac782f2363 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -85,9 +85,11 @@ class KOBO(USBMS): idx = bl_cache.get(lpath, None) if idx is not None: - imagename = self.normalize_path(self._main_prefix + '.kobo/images/' + ImageID + ' - NickelBookCover.parsed') - #print "Image name Normalized: " + imagename - bl[idx].thumbnail = ImageWrapper(imagename) + if ImageID is not None: + imagename = self.normalize_path(self._main_prefix + '.kobo/images/' + ImageID + ' - NickelBookCover.parsed') + #print "Image name Normalized: " + imagename + if imagename is not None: + bl[idx].thumbnail = ImageWrapper(imagename) bl_cache[lpath] = None if ContentType != '6': if self.update_metadata_item(bl[idx]): @@ -341,6 +343,7 @@ class KOBO(USBMS): else: # if path.startswith("file:///mnt/onboard/"): path = path.replace("file:///mnt/onboard/", self._main_prefix) + path = path.replace("/mnt/onboard/", self._main_prefix) # print "Internal: " + filename return path