From e2a088a53b1c2a1edd9b561c1912fe6a476ffff9 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Tue, 10 Aug 2021 23:13:40 +0530 Subject: [PATCH] Fix db events not being sent after changing library in GUI --- src/calibre/srv/library_broker.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/calibre/srv/library_broker.py b/src/calibre/srv/library_broker.py index 3fabdb3c41..a9e40e533a 100644 --- a/src/calibre/srv/library_broker.py +++ b/src/calibre/srv/library_broker.py @@ -216,7 +216,7 @@ class GuiLibraryBroker(LibraryBroker): library_path = self.original_path_map.get(library_path, library_path) db = LibraryDatabase(library_path, is_second_db=True) if self.listening_for_db_events: - db.add_listener(self.on_db_event) + db.new_api.add_listener(gui_on_db_event) return db def get(self, library_id=None): @@ -293,6 +293,8 @@ class GuiLibraryBroker(LibraryBroker): self.original_path_map[newloc] = original_path self.loaded_dbs[library_id] = db db.new_api.server_library_id = library_id + if self.listening_for_db_events: + db.new_api.add_listener(gui_on_db_event) if olddb is not None and samefile(path_for_db(olddb), path_for_db(db)): # This happens after a restore database, for example olddb.close(), olddb.break_cycles()