From 1a380f428114a4a3904b005e3b1d4fd8710b01d5 Mon Sep 17 00:00:00 2001 From: Pat Ferate Date: Thu, 11 Oct 2012 20:31:05 -0700 Subject: [PATCH] Expanding the 'Duplicates found' dialog to also display all entries [{Title} by {Author}] with the same title. --- src/calibre/gui2/add.py | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/calibre/gui2/add.py b/src/calibre/gui2/add.py index d48e962f90..822a43a3c3 100644 --- a/src/calibre/gui2/add.py +++ b/src/calibre/gui2/add.py @@ -382,12 +382,25 @@ class Adder(QObject): # {{{ if not duplicates: return self.duplicates_processed() self.pd.hide() - files = [_('%(title)s by %(author)s')%dict(title=x[0].title, - author=x[0].format_field('authors')[1]) for x in duplicates] + duplicate_message = [] + for x in duplicates: + duplicate_message.append('Already in Calibre database:') + matching_books = self.db.books_with_same_title(x[0]) + for book_id in matching_books: + book_mi = self.db.get_metadata(book_id, True) + duplicate_message.append(('\t%(title)s by %(author)s')% + dict(title=book_mi.title, + author=book_mi.format_field('authors')[1])) + duplicate_message.append('You are trying to add:') + duplicate_message.append(('\t%(title)s by %(author)s')% + dict(title=x[0].title, + author=x[0].format_field('authors')[1])) +# Maybe we can change the question dialog to include a checkbox for selectively +# adding found duplicates. if question_dialog(self._parent, _('Duplicates found!'), _('Books with the same title as the following already ' 'exist in the database. Add them anyway?'), - '\n'.join(files)): + '\n'.join(duplicate_message)): pd = QProgressDialog(_('Adding duplicates...'), '', 0, len(duplicates), self._parent) pd.setCancelButton(None)