mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-07 18:24:30 -04:00
Enhancement #1998705: Exclude folder names from “Check Library” results.
I also added tooltip text saying that ignoring folders and files in book folders is asking for data loss.
This commit is contained in:
parent
e09dbe0e7a
commit
ec3443ce48
@ -686,9 +686,12 @@ class ChooseLibraryAction(InterfaceAction):
|
|||||||
d = CheckLibraryDialog(self.gui, m.db)
|
d = CheckLibraryDialog(self.gui, m.db)
|
||||||
|
|
||||||
if not d.do_exec():
|
if not d.do_exec():
|
||||||
info_dialog(self.gui, _('No problems found'),
|
if question_dialog(self.gui, _('No problems found'),
|
||||||
_('The files in your library match the information '
|
_('The files in your library match the information in the database.\n\n'
|
||||||
'in the database.'), show=True)
|
"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:
|
finally:
|
||||||
self.gui.status_bar.clear_message()
|
self.gui.status_bar.clear_message()
|
||||||
|
|
||||||
|
@ -243,16 +243,22 @@ class CheckLibraryDialog(QDialog):
|
|||||||
h.addWidget(ln)
|
h.addWidget(ln)
|
||||||
self.name_ignores = QLineEdit()
|
self.name_ignores = QLineEdit()
|
||||||
self.name_ignores.setText(db.new_api.pref('check_library_ignore_names', ''))
|
self.name_ignores.setText(db.new_api.pref('check_library_ignore_names', ''))
|
||||||
self.name_ignores.setToolTip(
|
tt_ext = ('<br><br>' +
|
||||||
_('Enter comma-separated standard file name wildcards, such as synctoy*.dat'))
|
_('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('<p>' +
|
||||||
|
_('Enter comma-separated standard shell file name wildcards, such as synctoy*.dat. '
|
||||||
|
'Used in library, author, and book folders') +
|
||||||
|
tt_ext + '</p>')
|
||||||
ln.setBuddy(self.name_ignores)
|
ln.setBuddy(self.name_ignores)
|
||||||
h.addWidget(self.name_ignores)
|
h.addWidget(self.name_ignores)
|
||||||
le = QLabel(_('Extensions to ignore:'))
|
le = QLabel(_('Extensions to ignore:'))
|
||||||
h.addWidget(le)
|
h.addWidget(le)
|
||||||
self.ext_ignores = QLineEdit()
|
self.ext_ignores = QLineEdit()
|
||||||
self.ext_ignores.setText(db.new_api.pref('check_library_ignore_extensions', ''))
|
self.ext_ignores.setText(db.new_api.pref('check_library_ignore_extensions', ''))
|
||||||
self.ext_ignores.setToolTip(
|
self.ext_ignores.setToolTip('<p>' +
|
||||||
_('Enter comma-separated extensions without a leading dot. Used only in book folders'))
|
_('Enter comma-separated extensions without a leading dot. Used only in book folders') +
|
||||||
|
tt_ext + '</p>')
|
||||||
le.setBuddy(self.ext_ignores)
|
le.setBuddy(self.ext_ignores)
|
||||||
h.addWidget(self.ext_ignores)
|
h.addWidget(self.ext_ignores)
|
||||||
self._layout.addLayout(h)
|
self._layout.addLayout(h)
|
||||||
|
@ -180,8 +180,9 @@ class CheckLibrary:
|
|||||||
def process_book(self, lib, book_info):
|
def process_book(self, lib, book_info):
|
||||||
(db_path, title_dir, book_id) = book_info
|
(db_path, title_dir, book_id) = book_info
|
||||||
filenames = frozenset(f for f in os.listdir(os.path.join(lib, db_path))
|
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
|
if not self.ignore_name(f) and (
|
||||||
f == 'cover.jpg')
|
os.path.splitext(f)[1] not in self.ignore_ext or
|
||||||
|
f == 'cover.jpg' ))
|
||||||
book_id = int(book_id)
|
book_id = int(book_id)
|
||||||
formats = frozenset(filter(self.is_ebook_file, filenames))
|
formats = frozenset(filter(self.is_ebook_file, filenames))
|
||||||
book_formats = frozenset(x[0]+'.'+x[1].lower() for x in
|
book_formats = frozenset(x[0]+'.'+x[1].lower() for x in
|
||||||
|
Loading…
x
Reference in New Issue
Block a user