Fix the deletion of html, htm, txt and rtf by firmware version

This commit is contained in:
Timothy Legge 2010-11-29 23:51:55 -04:00
parent a5d7a19c34
commit 8a6e316e9f

View File

@ -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