diff --git a/src/calibre/devices/kobo/bookmark.py b/src/calibre/devices/kobo/bookmark.py index d0856d5758..56e76b39e9 100644 --- a/src/calibre/devices/kobo/bookmark.py +++ b/src/calibre/devices/kobo/bookmark.py @@ -55,6 +55,7 @@ class Bookmark(): # {{{ 'bm.volumeid = ? order by bm.volumeid, bm.chapterprogress', t) previous_chapter = 0 + bm_count = 0 for row in cursor: current_chapter = row[10] if previous_chapter == current_chapter: @@ -70,7 +71,7 @@ class Bookmark(): # {{{ e_type = 'Bookmark' text = row[9] # highlight is text with no annotation - elif text is not None and annotation is None: + elif text is not None and (annotation is None or annotation == ""): e_type = 'Highlight' elif text and annotation: e_type = 'Annotation' diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 50130f5ba0..e45710bb5c 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -967,11 +967,15 @@ class KOBO(USBMS): timestamp = bookmark.timestamp percent_read = bookmark.percent_read debug_print("Date: ", bookmark.last_read) - try: - last_read = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(calendar.timegm(time.strptime(bookmark.last_read, "%Y-%m-%dT%H:%M:%S")))) - except: - last_read = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(calendar.timegm(time.strptime(bookmark.last_read, "%Y-%m-%dT%H:%M:%S.%f")))) - + if bookmark.last_read is not None: + try: + last_read = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(calendar.timegm(time.strptime(bookmark.last_read, "%Y-%m-%dT%H:%M:%S")))) + except: + last_read = time.strftime("%Y-%m-%d %H:%M:%S", time.localtime(calendar.timegm(time.strptime(bookmark.last_read, "%Y-%m-%dT%H:%M:%S.%f")))) + else: + #self.datetime = time.gmtime() + last_read = time.strftime("%Y-%m-%d %H:%M:%S", time.gmtime()) + # debug_print("Percent read: ", percent_read) ka_soup = BeautifulSoup() dtc = 0