From 26b2670d9411b61d6bff19d30bc7937ed0f9b079 Mon Sep 17 00:00:00 2001 From: David Forrester Date: Wed, 5 Jun 2013 23:41:40 +1000 Subject: [PATCH] Kobo driver fix for deleting shelves on the Aura HD Remove empty shelves from the Aura HD home page when deleting books. Fixes #1187791 [Kobo driver fix for deleting shelves and the Aura HD home page](https://bugs.launchpad.net/calibre/+bug/1187791) --- src/calibre/devices/kobo/driver.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/calibre/devices/kobo/driver.py b/src/calibre/devices/kobo/driver.py index 51cbdd8cf7..a11fc240f7 100644 --- a/src/calibre/devices/kobo/driver.py +++ b/src/calibre/devices/kobo/driver.py @@ -35,7 +35,7 @@ class KOBO(USBMS): gui_name = 'Kobo Reader' description = _('Communicate with the Kobo Reader') author = 'Timothy Legge and David Forrester' - version = (2, 0, 11) + version = (2, 0, 12) dbversion = 0 fwversion = 0 @@ -1218,7 +1218,7 @@ class KOBOTOUCH(KOBO): min_dbversion_images_on_sdcard = 77 min_dbversion_activiy = 77 - max_supported_fwversion = (2,5,3) + max_supported_fwversion = (2,6,0) min_fwversion_images_on_sdcard = (2,4,1) has_kepubs = True @@ -2381,9 +2381,17 @@ class KOBOTOUCH(KOBO): "WHERE Shelf.Name = C.ShelfName " "AND c._IsDeleted <> 'true')") + delete_activity_query = ("DELETE FROM Activity " + "WHERE Type = 'Shelf' " + "AND NOT EXISTS " + "(SELECT 1 FROM Shelf " + "WHERE Shelf.Name = Activity.Id)" + ) + cursor = connection.cursor() cursor.execute(delete_query) cursor.execute(update_query) + cursor.execute(delete_activity_query) connection.commit() cursor.close()