From 934d4ba258fa71a23b6d3fe3b0748d11d5237e35 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 19 Jul 2013 21:15:02 +0530 Subject: [PATCH] Use the correct metadata backup implementation --- src/calibre/db/__init__.py | 3 +-- src/calibre/gui2/library/models.py | 8 ++++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/calibre/db/__init__.py b/src/calibre/db/__init__.py index b8e46b4ed2..434d9ae317 100644 --- a/src/calibre/db/__init__.py +++ b/src/calibre/db/__init__.py @@ -136,8 +136,7 @@ Various things that require other things before they can be migrated: columns/categories/searches info into self.field_metadata. 2. Port library/restore.py - 3. Replace the metadatabackup thread with the new implementation when using the new backend. - 4. Check that content server reloading on metadata,db change, metadata + 3. Check that content server reloading on metadata,db change, metadata backup, refresh gui on calibredb add and moving libraries all work (check them on windows as well for file locking issues) ''' diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index af293b864d..738b42a669 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -21,7 +21,7 @@ from calibre.utils.date import dt_factory, qt_to_dt, as_local_time from calibre.utils.icu import sort_key from calibre.utils.search_query_parser import SearchQueryParser from calibre.db.search import _match, CONTAINS_MATCH, EQUALS_MATCH, REGEXP_MATCH -from calibre.library.caches import (MetadataBackup, force_to_bool) +from calibre.library.caches import force_to_bool from calibre.library.save_to_disk import find_plugboard from calibre import strftime, isbytestring from calibre.constants import filesystem_encoding, DEBUG, config_dir @@ -234,6 +234,10 @@ class BooksModel(QAbstractTableModel): # {{{ self.start_metadata_backup() def start_metadata_backup(self): + if hasattr(self.db, 'new_api'): + from calibre.db.backup import MetadataBackup + else: + from calibre.library.caches import MetadataBackup self.metadata_backup = MetadataBackup(self.db) self.metadata_backup.start() @@ -1209,7 +1213,6 @@ class DeviceBooksModel(BooksModel): # {{{ self.book_in_library = None self.sync_icon = QIcon(I('sync.png')) - def counts(self): return Counts(len(self.db), len(self.db), len(self.map)) @@ -1613,3 +1616,4 @@ class DeviceBooksModel(BooksModel): # {{{ # }}} +