From 06d2f112f1a1622e719e8d9d4426abcebf0682f9 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Fri, 9 Jul 2010 10:26:57 -0300 Subject: [PATCH 1/2] Fix getting the contentid for html files. Should work but currently untested --- src/calibre/devices/kobo/driver.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index ac782f2363..8b7e71bb4b 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -233,6 +233,10 @@ class KOBO(USBMS): #print "Path: " + path ContentID = self.contentid_from_path(path, ContentType) # print "ContentID: " + ContentID + if extension == '.html': + ContentType = 999 # Yet another hack: to get around Kobo changing how ContentID is stored + ContentID = self.contentid_from_path(path, ContentType) + ImageID = self.delete_via_sql(ContentID, ContentType) #print " We would now delete the Images for" + ImageID self.delete_images(ImageID) @@ -316,6 +320,11 @@ class KOBO(USBMS): ContentID = ContentID.replace(self._main_prefix, '') if self._card_a_prefix is not None: ContentID = ContentID.replace(self._card_a_prefix, '') + elif ContentType == 999: # HTML Files + ContentID = path + ContentID = ContentID.replace(self._main_prefix, "/mnt/onboard/") + if self._card_a_prefix is not None: + ContentID = ContentID.replace(self._card_a_prefix, "/mnt/sd/") else: # ContentType = 16 ContentID = path ContentID = ContentID.replace(self._main_prefix, "file:///mnt/onboard/") From 664865222ec6fa4de7e7f6e578e3ce59f1421655 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Fri, 9 Jul 2010 13:46:57 -0300 Subject: [PATCH 2/2] Fix getting the contentid for txt files. Should work but currently untested --- src/calibre/devices/kobo/driver.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 8b7e71bb4b..131775e66a 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -227,13 +227,13 @@ class KOBO(USBMS): #print "kobo book" ContentType = 6 ContentID = self.contentid_from_path(path, ContentType) - if extension == '.pdf' or extension == '.epub': + elif extension == '.pdf' or extension == '.epub': # print "ePub or pdf" ContentType = 16 #print "Path: " + path ContentID = self.contentid_from_path(path, ContentType) # print "ContentID: " + ContentID - if extension == '.html': + else: # if extension == '.html' or extension == '.txt': ContentType = 999 # Yet another hack: to get around Kobo changing how ContentID is stored ContentID = self.contentid_from_path(path, ContentType)