Fix annoying little bug related to using an SD card. Caused by path from content id fix

This commit is contained in:
Timothy Legge 2010-06-24 22:48:29 -03:00
parent d871e221e3
commit 8bd036d9f4

View File

@ -129,13 +129,11 @@ class KOBO(USBMS):
path = self.path_from_contentid(row[3], row[5], oncard) path = self.path_from_contentid(row[3], row[5], oncard)
mime = mime_type_ext(path_to_ext(row[3])) mime = mime_type_ext(path_to_ext(row[3]))
if oncard != 'carda' and oncard != 'cardb': if oncard != 'carda' and oncard != 'cardb' and not row[3].startswith("file:///mnt/sd/"):
# print "shortbook: " + path
changed = update_booklist(self._main_prefix, path, row[0], row[1], mime, row[2], row[5], row[6]) changed = update_booklist(self._main_prefix, path, row[0], row[1], mime, row[2], row[5], row[6])
elif oncard == 'carda': # print "shortbook: " + path
elif oncard == 'carda' and row[3].startswith("file:///mnt/sd/"):
changed = update_booklist(self._card_a_prefix, path, row[0], row[1], mime, row[2], row[5], row[6]) changed = update_booklist(self._card_a_prefix, path, row[0], row[1], mime, row[2], row[5], row[6])
else:
print "Add card b support"
if changed: if changed:
need_sync = True need_sync = True
@ -333,19 +331,21 @@ class KOBO(USBMS):
def path_from_contentid(self, ContentID, ContentType, oncard): def path_from_contentid(self, ContentID, ContentType, oncard):
path = ContentID path = ContentID
if oncard != 'carda' and oncard != 'cardb': if oncard == 'cardb':
print 'path from_contentid cardb'
elif oncard == 'carda':
path = path.replace("file:///mnt/sd/", self._card_a_prefix)
# print "SD Card: " + filename
else:
if ContentType == "6": if ContentType == "6":
# This is a hack as the kobo files do not exist # This is a hack as the kobo files do not exist
# but the path is required to make a unique id # but the path is required to make a unique id
# for calibre's reference # for calibre's reference
path = self._main_prefix + os.sep + path + '.kobo' path = self._main_prefix + path + '.kobo'
# print "Path: " + path
else: else:
if path.startswith("file:///mnt/onboard/"): # if path.startswith("file:///mnt/onboard/"):
path = path.replace("file:///mnt/onboard/", self._main_prefix) path = path.replace("file:///mnt/onboard/", self._main_prefix)
# print "Internal: " + filename # print "Internal: " + filename
elif oncard == 'carda':
if path.startswith("file:///mnt/sd/"):
path = path.replace("file:///mnt/sd/", self._card_a_prefix)
# print "SD Card: " + filename
return path return path