mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-06-23 15:30:45 -04:00
Bump supported Kobo firmware versions
And fix handling of the ignored shelves as it wasn't being sanitized.
This commit is contained in:
parent
b69386b46e
commit
489e43ead1
@ -950,6 +950,7 @@ class KOBO(USBMS):
|
|||||||
def sync_booklists(self, booklists, end_session=True):
|
def sync_booklists(self, booklists, end_session=True):
|
||||||
debug_print('KOBO:sync_booklists - start')
|
debug_print('KOBO:sync_booklists - start')
|
||||||
paths = self.get_device_paths()
|
paths = self.get_device_paths()
|
||||||
|
debug_print('KOBO:sync_booklists - booklists:', booklists)
|
||||||
|
|
||||||
blists = {}
|
blists = {}
|
||||||
for i in paths:
|
for i in paths:
|
||||||
@ -1349,7 +1350,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
' Based on the existing Kobo driver by %s.') % KOBO.author
|
' Based on the existing Kobo driver by %s.') % KOBO.author
|
||||||
# icon = I('devices/kobotouch.jpg')
|
# icon = I('devices/kobotouch.jpg')
|
||||||
|
|
||||||
supported_dbversion = 160
|
supported_dbversion = 161
|
||||||
min_supported_dbversion = 53
|
min_supported_dbversion = 53
|
||||||
min_dbversion_series = 65
|
min_dbversion_series = 65
|
||||||
min_dbversion_externalid = 65
|
min_dbversion_externalid = 65
|
||||||
@ -1362,7 +1363,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
# Starting with firmware version 3.19.x, the last number appears to be is a
|
# Starting with firmware version 3.19.x, the last number appears to be is a
|
||||||
# build number. A number will be recorded here but it can be safely ignored
|
# build number. A number will be recorded here but it can be safely ignored
|
||||||
# when testing the firmware version.
|
# when testing the firmware version.
|
||||||
max_supported_fwversion = (4, 23, 15439)
|
max_supported_fwversion = (4, 24, 15672)
|
||||||
# The following document firwmare versions where new function or devices were added.
|
# The following document firwmare versions where new function or devices were added.
|
||||||
# Not all are used, but this feels a good place to record it.
|
# Not all are used, but this feels a good place to record it.
|
||||||
min_fwversion_shelves = (2, 0, 0)
|
min_fwversion_shelves = (2, 0, 0)
|
||||||
@ -2891,29 +2892,35 @@ class KOBOTOUCH(KOBO):
|
|||||||
def delete_empty_bookshelves(self, connection):
|
def delete_empty_bookshelves(self, connection):
|
||||||
debug_print("KoboTouch:delete_empty_bookshelves - start")
|
debug_print("KoboTouch:delete_empty_bookshelves - start")
|
||||||
|
|
||||||
ignore_collections_in = ''
|
ignore_collections_placeholder = ''
|
||||||
|
ignore_collections_values = []
|
||||||
if self.ignore_collections_names:
|
if self.ignore_collections_names:
|
||||||
ignore_collections_in = ','.join(["'%s'" % collections_name for collections_name in self.ignore_collections_names])
|
placeholder = ',?'
|
||||||
ignore_collections_in = ', %s' % ignore_collections_in
|
ignore_collections_placeholder = ''.join(placeholder for unused in self.ignore_collections_names)
|
||||||
|
ignore_collections_values.extend(self.ignore_collections_names)
|
||||||
|
debug_print("KoboTouch:delete_empty_bookshelves - ignore_collections_in=", ignore_collections_placeholder)
|
||||||
|
debug_print("KoboTouch:delete_empty_bookshelves - ignore_collections=", ignore_collections_values)
|
||||||
|
|
||||||
delete_query = ("DELETE FROM Shelf "
|
delete_query = ("DELETE FROM Shelf "
|
||||||
"WHERE Shelf._IsSynced = 'false' "
|
"WHERE Shelf._IsSynced = 'false' "
|
||||||
"AND Shelf.InternalName not in ('Shortlist', 'Wishlist'" + ignore_collections_in + ") "
|
"AND Shelf.InternalName not in ('Shortlist', 'Wishlist'" + ignore_collections_placeholder + ") "
|
||||||
"AND (Type IS NULL OR Type <> 'SystemTag') " # Collections are created with Type of NULL and change after a sync.
|
"AND (Type IS NULL OR Type <> 'SystemTag') " # Collections are created with Type of NULL and change after a sync.
|
||||||
"AND NOT EXISTS "
|
"AND NOT EXISTS "
|
||||||
"(SELECT 1 FROM ShelfContent c "
|
"(SELECT 1 FROM ShelfContent c "
|
||||||
"WHERE Shelf.Name = C.ShelfName "
|
"WHERE Shelf.Name = C.ShelfName "
|
||||||
"AND c._IsDeleted <> 'true')")
|
"AND c._IsDeleted <> 'true')")
|
||||||
|
debug_print("KoboTouch:delete_empty_bookshelves - delete_query=", delete_query)
|
||||||
|
|
||||||
update_query = ("UPDATE Shelf "
|
update_query = ("UPDATE Shelf "
|
||||||
"SET _IsDeleted = 'true' "
|
"SET _IsDeleted = 'true' "
|
||||||
"WHERE Shelf._IsSynced = 'true' "
|
"WHERE Shelf._IsSynced = 'true' "
|
||||||
"AND Shelf.InternalName not in ('Shortlist', 'Wishlist'" + ignore_collections_in + ") "
|
"AND Shelf.InternalName not in ('Shortlist', 'Wishlist'" + ignore_collections_placeholder + ") "
|
||||||
"AND (Type IS NULL OR Type <> 'SystemTag') "
|
"AND (Type IS NULL OR Type <> 'SystemTag') "
|
||||||
"AND NOT EXISTS "
|
"AND NOT EXISTS "
|
||||||
"(SELECT 1 FROM ShelfContent C "
|
"(SELECT 1 FROM ShelfContent C "
|
||||||
"WHERE Shelf.Name = C.ShelfName "
|
"WHERE Shelf.Name = C.ShelfName "
|
||||||
"AND c._IsDeleted <> 'true')")
|
"AND c._IsDeleted <> 'true')")
|
||||||
|
debug_print("KoboTouch:delete_empty_bookshelves - update_query=", update_query)
|
||||||
|
|
||||||
delete_activity_query = ("DELETE FROM Activity "
|
delete_activity_query = ("DELETE FROM Activity "
|
||||||
"WHERE Type = 'Shelf' "
|
"WHERE Type = 'Shelf' "
|
||||||
@ -2922,10 +2929,11 @@ class KOBOTOUCH(KOBO):
|
|||||||
"WHERE Shelf.Name = Activity.Id "
|
"WHERE Shelf.Name = Activity.Id "
|
||||||
"AND Shelf._IsDeleted = 'false')"
|
"AND Shelf._IsDeleted = 'false')"
|
||||||
)
|
)
|
||||||
|
debug_print("KoboTouch:delete_empty_bookshelves - delete_activity_query=", delete_activity_query)
|
||||||
|
|
||||||
cursor = connection.cursor()
|
cursor = connection.cursor()
|
||||||
cursor.execute(delete_query)
|
cursor.execute(delete_query, ignore_collections_values)
|
||||||
cursor.execute(update_query)
|
cursor.execute(update_query, ignore_collections_values)
|
||||||
if self.has_activity_table():
|
if self.has_activity_table():
|
||||||
cursor.execute(delete_activity_query)
|
cursor.execute(delete_activity_query)
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user