From ec3443ce4885d0eac873bc25101a38f45cc6680a Mon Sep 17 00:00:00 2001 From: Charles Haley Date: Mon, 5 Dec 2022 12:24:27 +0000 Subject: [PATCH] =?UTF-8?q?Enhancement=20#1998705:=20Exclude=20folder=20na?= =?UTF-8?q?mes=20from=20=E2=80=9CCheck=20Library=E2=80=9D=20results.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit I also added tooltip text saying that ignoring folders and files in book folders is asking for data loss. --- src/calibre/gui2/actions/choose_library.py | 9 ++++++--- src/calibre/gui2/dialogs/check_library.py | 14 ++++++++++---- src/calibre/library/check_library.py | 5 +++-- 3 files changed, 19 insertions(+), 9 deletions(-) diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index 6333b787f4..cbbfb4c7ba 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -686,9 +686,12 @@ class ChooseLibraryAction(InterfaceAction): d = CheckLibraryDialog(self.gui, m.db) if not d.do_exec(): - info_dialog(self.gui, _('No problems found'), - _('The files in your library match the information ' - 'in the database.'), show=True) + if question_dialog(self.gui, _('No problems found'), + _('The files in your library match the information in the database.\n\n' + "Choose 'Open dialog' to change settings and run the check again."), + yes_text=_('Open dialog'), yes_icon='gear.png', + no_text=_('Finished')): + d.exec() finally: self.gui.status_bar.clear_message() diff --git a/src/calibre/gui2/dialogs/check_library.py b/src/calibre/gui2/dialogs/check_library.py index a407eb5dcc..b984725d73 100644 --- a/src/calibre/gui2/dialogs/check_library.py +++ b/src/calibre/gui2/dialogs/check_library.py @@ -243,16 +243,22 @@ class CheckLibraryDialog(QDialog): h.addWidget(ln) self.name_ignores = QLineEdit() self.name_ignores.setText(db.new_api.pref('check_library_ignore_names', '')) - self.name_ignores.setToolTip( - _('Enter comma-separated standard file name wildcards, such as synctoy*.dat')) + tt_ext = ('

' + + _('Note: ignoring folders or files inside a book folder can lead to data loss. Ignored ' + "folders and files will be lost if you change the book's title or author(s).")) + self.name_ignores.setToolTip('

' + + _('Enter comma-separated standard shell file name wildcards, such as synctoy*.dat. ' + 'Used in library, author, and book folders') + + tt_ext + '

') ln.setBuddy(self.name_ignores) h.addWidget(self.name_ignores) le = QLabel(_('Extensions to ignore:')) h.addWidget(le) self.ext_ignores = QLineEdit() self.ext_ignores.setText(db.new_api.pref('check_library_ignore_extensions', '')) - self.ext_ignores.setToolTip( - _('Enter comma-separated extensions without a leading dot. Used only in book folders')) + self.ext_ignores.setToolTip('

' + + _('Enter comma-separated extensions without a leading dot. Used only in book folders') + + tt_ext + '

') le.setBuddy(self.ext_ignores) h.addWidget(self.ext_ignores) self._layout.addLayout(h) diff --git a/src/calibre/library/check_library.py b/src/calibre/library/check_library.py index 403072d016..d49cb2b686 100644 --- a/src/calibre/library/check_library.py +++ b/src/calibre/library/check_library.py @@ -180,8 +180,9 @@ class CheckLibrary: def process_book(self, lib, book_info): (db_path, title_dir, book_id) = book_info filenames = frozenset(f for f in os.listdir(os.path.join(lib, db_path)) - if os.path.splitext(f)[1] not in self.ignore_ext or - f == 'cover.jpg') + if not self.ignore_name(f) and ( + os.path.splitext(f)[1] not in self.ignore_ext or + f == 'cover.jpg' )) book_id = int(book_id) formats = frozenset(filter(self.is_ebook_file, filenames)) book_formats = frozenset(x[0]+'.'+x[1].lower() for x in