From 947fa2769df049e859284c958fd0177c34885c3e Mon Sep 17 00:00:00 2001 From: Charles Haley <> Date: Fri, 10 Sep 2010 09:58:39 +0100 Subject: [PATCH] Fix matching books with no --- src/calibre/gui2/device.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/calibre/gui2/device.py b/src/calibre/gui2/device.py index e002fe916b..3cab6ab21d 100644 --- a/src/calibre/gui2/device.py +++ b/src/calibre/gui2/device.py @@ -1357,6 +1357,14 @@ class DeviceMixin(object): # {{{ c = self.book_db_id_counts.get(db_id, 0) self.book_db_id_counts[db_id] = c + 1 uuid = getattr(book, 'uuid', None) + if uuid is None and db_id is not None: + # Catch the case where a book on the device has no UUID + # but was matched against some book in the library. + try: + uuid = self.library_view.model().db.uuid(db_id, + index_is_id=True) + except: + pass if uuid is not None: self.book_db_uuid_cache[i].add(uuid) self.book_db_uuid_path_map[uuid] = book.path