def show_matched_books_in_library(self, *args): view = self.gui.current_view() rows = view.selectionModel().selectedRows() if not rows or len(rows) != 1: d = error_dialog(self.gui, _('Match books'), _('You must select one book')) d.exec() return device_book_index = view.model().indices(rows)[0] device_db = view.model().db db = self.gui.current_db.new_api book = device_db[device_book_index] matching_book_ids = db.books_matching_device_book(book.lpath) if not matching_book_ids: if question_dialog( self.gui, _('No matching books'), _('No matching books found in the calibre library. Do you want to specify the' ' matching book manually?')): MatchBooks(self.gui, view, device_book_index, rows[0]).exec() return ids = tuple(sorted(matching_book_ids, reverse=True)) self.gui.library_view.select_rows(ids) self.gui.show_library_view() self.gui.iactions['Edit Metadata'].refresh_books_after_metadata_edit( ids)
def match_books_in_library(self, *args): view = self.gui.current_view() rows = view.selectionModel().selectedRows() if not rows or len(rows) != 1: d = error_dialog(self.gui, _('Match books'), _('You must select one book')) d.exec_() return id_ = view.model().indices(rows)[0] MatchBooks(self.gui, view, id_, rows[0]).exec_()