mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Reading status wiped for older Kobo Touch firmware
Kobo driver: Fix reading status being cleared when connecting to a Kobo with older firmware and metadata management set to automatic. Fixes #1230018 [Reading status wiped for older Kobo Firmware](https://bugs.launchpad.net/calibre/+bug/1230018) When a Kobo Touch running a 1.9.x firmware was connected, the reading status of all books was wiped out. This was to do with the way the collections were managed. If a shelf/collection attribute was not defined, the reading status was being cleared when it should not have been. Also skipping a loop over the books if shelf and series management is not being done.
This commit is contained in:
parent
90f095a8a5
commit
0bcee3f721
@ -792,6 +792,7 @@ class KOBO(USBMS):
|
|||||||
# debug_print(' Commit: Set FavouritesIndex')
|
# debug_print(' Commit: Set FavouritesIndex')
|
||||||
|
|
||||||
def update_device_database_collections(self, booklists, collections_attributes, oncard):
|
def update_device_database_collections(self, booklists, collections_attributes, oncard):
|
||||||
|
debug_print("Kobo:update_device_database_collections - oncard='%s'"%oncard)
|
||||||
if self.modify_database_check("update_device_database_collections") == False:
|
if self.modify_database_check("update_device_database_collections") == False:
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -822,7 +823,7 @@ class KOBO(USBMS):
|
|||||||
collections_attributes = ['tags']
|
collections_attributes = ['tags']
|
||||||
|
|
||||||
collections = booklists.get_collections(collections_attributes)
|
collections = booklists.get_collections(collections_attributes)
|
||||||
# debug_print('Collections', collections)
|
# debug_print('Kobo:update_device_database_collections - Collections:', collections)
|
||||||
|
|
||||||
# Create a connection to the sqlite database
|
# Create a connection to the sqlite database
|
||||||
# Needs to be outside books collection as in the case of removing
|
# Needs to be outside books collection as in the case of removing
|
||||||
@ -2171,8 +2172,10 @@ class KOBOTOUCH(KOBO):
|
|||||||
# 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
|
||||||
if self.dbversion < 53:
|
if self.dbversion < 53:
|
||||||
|
debug_print("KoboTouch:update_device_database_collections - calling reset_readstatus")
|
||||||
self.reset_readstatus(connection, oncard)
|
self.reset_readstatus(connection, oncard)
|
||||||
if self.dbversion >= 14:
|
if self.dbversion >= 14:
|
||||||
|
debug_print("KoboTouch:update_device_database_collections - calling reset_favouritesindex")
|
||||||
self.reset_favouritesindex(connection, oncard)
|
self.reset_favouritesindex(connection, oncard)
|
||||||
|
|
||||||
# debug_print("KoboTouch:update_device_database_collections - length collections=", len(collections))
|
# debug_print("KoboTouch:update_device_database_collections - length collections=", len(collections))
|
||||||
@ -2240,7 +2243,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
debug_print(' category not added to book.device_collections', book.device_collections)
|
debug_print(' category not added to book.device_collections', book.device_collections)
|
||||||
debug_print("KoboTouch:update_device_database_collections - end for category='%s'"%category)
|
debug_print("KoboTouch:update_device_database_collections - end for category='%s'"%category)
|
||||||
|
|
||||||
else: # No collections
|
elif bookshelf_attribute: # No collections but have set the shelf option
|
||||||
# Since no collections exist the ReadStatus needs to be reset to 0 (Unread)
|
# Since no collections exist the ReadStatus needs to be reset to 0 (Unread)
|
||||||
debug_print("No Collections - reseting ReadStatus")
|
debug_print("No Collections - reseting ReadStatus")
|
||||||
if self.dbversion < 53:
|
if self.dbversion < 53:
|
||||||
@ -2249,7 +2252,8 @@ class KOBOTOUCH(KOBO):
|
|||||||
debug_print("No Collections - resetting FavouritesIndex")
|
debug_print("No Collections - resetting FavouritesIndex")
|
||||||
self.reset_favouritesindex(connection, oncard)
|
self.reset_favouritesindex(connection, oncard)
|
||||||
|
|
||||||
if self.supports_bookshelves() or self.supports_series():
|
# Set the series info and cleanup the bookshelves only if the firmware supports them and the user has set the options.
|
||||||
|
if (self.supports_bookshelves() or self.supports_series()) and (bookshelf_attribute or update_series_details):
|
||||||
debug_print("KoboTouch:update_device_database_collections - managing bookshelves and series.")
|
debug_print("KoboTouch:update_device_database_collections - managing bookshelves and series.")
|
||||||
|
|
||||||
self.series_set = 0
|
self.series_set = 0
|
||||||
|
Loading…
x
Reference in New Issue
Block a user