From e8fafb52e3825c1414d9ddc02383aaf4f1858e01 Mon Sep 17 00:00:00 2001 From: Timothy Legge Date: Sat, 20 Nov 2010 00:21:09 -0400 Subject: [PATCH] Fix 7591 - Im_Reading list gets truncated under windows --- src/calibre/devices/kobo/driver.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index b2cc99fdb8..934dc0879e 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -93,7 +93,7 @@ class KOBO(USBMS): lpath = path.partition(self.normalize_path(prefix))[2] if lpath.startswith(os.sep): lpath = lpath[len(os.sep):] - lpath = lpath.replace('\\', '/') + lpath = lpath.replace('\\', '/') # debug_print("LPATH: ", lpath, " - Title: " , title) playlist_map = {} @@ -354,7 +354,7 @@ class KOBO(USBMS): ContentID = ContentID.replace(self._main_prefix, '') else: ContentID = path - ContentID = ContentID.replace(self._main_prefix + '.kobo/kepub/', '') + ContentID = ContentID.replace(self._main_prefix + self.normalize_path('.kobo/kepub/'), '') if self._card_a_prefix is not None: ContentID = ContentID.replace(self._card_a_prefix, '') @@ -507,7 +507,10 @@ class KOBO(USBMS): t = (ContentID,) cursor.execute('select DateLastRead from Content where BookID is Null and ContentID = ?', t) result = cursor.fetchone() - datelastread = result[0] if result[0] is not None else '1970-01-01T00:00:00' + if result is None: + datelastread = '1970-01-01T00:00:00' + else: + datelastread = result[0] if result[0] is not None else '1970-01-01T00:00:00' t = (datelastread,ContentID,)