From f2f411f9399788162e68a56df15d921c3e572c00 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Jul 2013 22:13:32 +0530 Subject: [PATCH] Accidentally ignored commit_dirty_cache() --- src/calibre/db/cache.py | 6 ++++++ src/calibre/db/legacy.py | 6 +----- src/calibre/db/tests/legacy.py | 2 +- src/calibre/gui2/ui.py | 3 ++- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/calibre/db/cache.py b/src/calibre/db/cache.py index 7a17f3468b..7cfe9bc4a6 100644 --- a/src/calibre/db/cache.py +++ b/src/calibre/db/cache.py @@ -800,6 +800,12 @@ class Cache(object): self.dirtied_sequence = max(new_dirtied.itervalues()) + 1 self.dirtied_cache.update(new_dirtied) + @write_api + def commit_dirty_cache(self): + book_ids = [(x,) for x in self.dirtied_cache] + if book_ids: + self.backend.conn.executemany('INSERT OR IGNORE INTO metadata_dirtied (book) VALUES (?)', book_ids) + @write_api def set_field(self, name, book_id_to_val_map, allow_case_change=True, do_path_update=True): f = self.fields[name] diff --git a/src/calibre/db/legacy.py b/src/calibre/db/legacy.py index 54f1fe5c1d..8cf6007479 100644 --- a/src/calibre/db/legacy.py +++ b/src/calibre/db/legacy.py @@ -890,6 +890,7 @@ LibraryDatabase.saved_search_set_all = MT(lambda self, smap:self.new_api.saved_s LibraryDatabase.saved_search_delete = MT(lambda self, x:self.new_api.saved_search_delete(x)) LibraryDatabase.saved_search_add = MT(lambda self, x, y:self.new_api.saved_search_add(x, y)) LibraryDatabase.saved_search_rename = MT(lambda self, x, y:self.new_api.saved_search_rename(x, y)) +LibraryDatabase.commit_dirty_cache = MT(lambda self: self.new_api.commit_dirty_cache()) # Cleaning is not required anymore LibraryDatabase.clean = LibraryDatabase.clean_custom = MT(lambda self:None) LibraryDatabase.clean_standard_field = MT(lambda self, field, commit=False:None) @@ -899,8 +900,3 @@ LibraryDatabase.commit = MT(lambda self:None) del MT - - - - - diff --git a/src/calibre/db/tests/legacy.py b/src/calibre/db/tests/legacy.py index 0c4efb9f6e..f9caa7a304 100644 --- a/src/calibre/db/tests/legacy.py +++ b/src/calibre/db/tests/legacy.py @@ -396,7 +396,7 @@ class LegacyTest(BaseTest): # Internal API 'clean_user_categories', 'cleanup_tags', 'books_list_filter', 'conn', 'connect', 'construct_file_name', - 'construct_path_name', 'clear_dirtied', 'commit_dirty_cache', 'initialize_database', 'initialize_dynamic', + 'construct_path_name', 'clear_dirtied', 'initialize_database', 'initialize_dynamic', 'run_import_plugins', 'vacuum', 'set_path', 'row', 'row_factory', 'rows', 'rmtree', 'series_index_pat', 'import_old_database', 'dirtied_lock', 'dirtied_cache', 'dirty_queue_length', 'dirty_books_referencing', 'windows_check_if_files_in_use', 'get_metadata_for_dump', 'get_a_dirtied_book', 'dirtied_sequence', diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 6f57ee060a..e2f02eb578 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -876,7 +876,8 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ try: self.shutdown(write_settings=False) except: - pass + import traceback + traceback.print_exc() e.accept() else: e.ignore()