From f826dcd050ae262aaef1aa7d6a75188515f54b67 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Mon, 29 Nov 2010 22:14:23 -0400 Subject: [PATCH 1/3] Fix deleting txt documents --- src/calibre/devices/kobo/driver.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 0eddf26549..ebb3f60101 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -220,6 +220,7 @@ class KOBO(USBMS): # 2) volume_shorcover # 2) content +# debug_print('delete_via_sql: ContentID: ', ContentID, 'ContentType: ', ContentType) connection = sqlite.connect(self.normalize_path(self._main_prefix + '.kobo/KoboReader.sqlite')) cursor = connection.cursor() t = (ContentID,) @@ -400,6 +401,9 @@ class KOBO(USBMS): elif extension == '.pdf' or extension == '.epub': # print "ePub or pdf" ContentType = 16 + elif extension == '.txt': + # print "txt" + ContentType = 901 else: # if extension == '.html' or extension == '.txt': ContentType = 999 # Yet another hack: to get around Kobo changing how ContentID is stored return ContentType From a5d7a19c341326d3359798a724ed4e4d1de1d916 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Mon, 29 Nov 2010 23:24:31 -0400 Subject: [PATCH 2/3] Allow html, htm and rtf documents to be deleted --- 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 ebb3f60101..981bf3decb 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -401,7 +401,7 @@ class KOBO(USBMS): elif extension == '.pdf' or extension == '.epub': # print "ePub or pdf" ContentType = 16 - elif extension == '.txt': + elif extension == '.rtf' or extension == '.txt' or extension == '.htm' or extension == '.html': # print "txt" ContentType = 901 else: # if extension == '.html' or extension == '.txt': From 8a6e316e9fdcfd36c61b9a52a8a65c5ac6d0e1a2 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Mon, 29 Nov 2010 23:51:55 -0400 Subject: [PATCH 3/3] Fix the deletion of html, htm, txt and rtf by firmware version --- src/calibre/devices/kobo/driver.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 981bf3decb..b76ee4b1c3 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -79,11 +79,11 @@ class KOBO(USBMS): # Determine the firmware version f = open(self.normalize_path(self._main_prefix + '.kobo/version'), 'r') - fwversion = f.readline().split(',')[2] + self.fwversion = f.readline().split(',')[2] f.close() - if fwversion != '1.0' and fwversion != '1.4': + if self.fwversion != '1.0' and self.fwversion != '1.4': self.has_kepubs = True - debug_print('Version of firmware: ', fwversion, 'Has kepubs:', self.has_kepubs) + debug_print('Version of firmware: ', self.fwversion, 'Has kepubs:', self.has_kepubs) self.booklist_class.rebuild_collections = self.rebuild_collections @@ -220,7 +220,7 @@ class KOBO(USBMS): # 2) volume_shorcover # 2) content -# debug_print('delete_via_sql: ContentID: ', ContentID, 'ContentType: ', ContentType) + debug_print('delete_via_sql: ContentID: ', ContentID, 'ContentType: ', ContentType) connection = sqlite.connect(self.normalize_path(self._main_prefix + '.kobo/KoboReader.sqlite')) cursor = connection.cursor() t = (ContentID,) @@ -403,7 +403,10 @@ class KOBO(USBMS): ContentType = 16 elif extension == '.rtf' or extension == '.txt' or extension == '.htm' or extension == '.html': # print "txt" - ContentType = 901 + if self.fwversion == '1.0' or self.fwversion == '1.4' or self.fwversion == '1.7.4': + ContentType = 999 + else: + ContentType = 901 else: # if extension == '.html' or extension == '.txt': ContentType = 999 # Yet another hack: to get around Kobo changing how ContentID is stored return ContentType