Fix reading status problem with old Kobo firmware

Recent changes in the handling of collections in the KoboTouch driver
broke how these were handled for the 1.9.x firmware. The change meant
the reading status of all books in the device was reset. The problem was
reported in http://www.mobileread.com/forums/showthread.php?t=278987.
This commit is contained in:
David 2016-10-19 22:43:49 +11:00
parent 0449f879f7
commit 73c420471d

View File

@ -2248,8 +2248,9 @@ class KOBOTOUCH(KOBO):
with closing(self.device_database_connection()) as connection: with closing(self.device_database_connection()) as connection:
if self.manage_collections and collections: if self.manage_collections:
# debug_print("KoboTouch:update_device_database_collections - length collections=" + unicode(len(collections))) if collections:
# debug_print("KoboTouch:update_device_database_collections - length collections=" + unicode(len(collections)))
# Need to reset the collections outside the particular loops # Need to reset the collections outside the particular loops
# otherwise the last item will not be removed # otherwise the last item will not be removed
@ -2270,7 +2271,7 @@ class KOBOTOUCH(KOBO):
# if category in self.bookshelvelist: # if category in self.bookshelvelist:
# debug_print("Category: ", category, " id = ", readstatuslist.get(category)) # debug_print("Category: ", category, " id = ", readstatuslist.get(category))
for book in books: for book in books:
# debug_print(' Title:', book.title, 'category: ', category) # debug_print(' Title:', book.title, 'category: ', category)
show_debug = self.is_debugging_title(book.title) show_debug = self.is_debugging_title(book.title)
if show_debug: if show_debug:
debug_print(' Title="%s"'%book.title, 'category="%s"'%category) debug_print(' Title="%s"'%book.title, 'category="%s"'%category)
@ -2302,6 +2303,7 @@ class KOBOTOUCH(KOBO):
self.set_bookshelf(connection, book, category) self.set_bookshelf(connection, book, category)
category_added = True category_added = True
elif category in readstatuslist.keys(): elif category in readstatuslist.keys():
debug_print("KoboTouch:update_device_database_collections - about to set_readstatus - category='%s'"%(category, ))
# Manage ReadStatus # Manage ReadStatus
self.set_readstatus(connection, book.contentID, readstatuslist.get(category)) self.set_readstatus(connection, book.contentID, readstatuslist.get(category))
category_added = True category_added = True
@ -2944,11 +2946,11 @@ class KOBOTOUCH(KOBO):
@property @property
def manage_collections(self): def manage_collections(self):
return self.get_pref('manage_collections') and self.supports_bookshelves return self.get_pref('manage_collections')
@property @property
def create_collections(self): def create_collections(self):
return self.manage_collections and self.get_pref('create_collections') and len(self.collections_columns) > 0 return self.manage_collections and self.supports_bookshelves and self.get_pref('create_collections') and len(self.collections_columns) > 0
@property @property
def collections_columns(self): def collections_columns(self):