diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py index aadf86eef9..ea3eef8c6f 100644 --- a/src/calibre/gui2/__init__.py +++ b/src/calibre/gui2/__init__.py @@ -102,6 +102,7 @@ defs['auto_add_path'] = None defs['auto_add_check_for_duplicates'] = False defs['blocked_auto_formats'] = [] defs['auto_add_auto_convert'] = True +defs['auto_add_everything'] = False defs['ui_style'] = 'calibre' if iswindows or isosx else 'system' defs['tag_browser_old_look'] = False defs['book_list_tooltips'] = True diff --git a/src/calibre/gui2/auto_add.py b/src/calibre/gui2/auto_add.py index bb4b652526..b200522fa4 100644 --- a/src/calibre/gui2/auto_add.py +++ b/src/calibre/gui2/auto_add.py @@ -20,6 +20,14 @@ from calibre.gui2.dialogs.duplicates import DuplicatesQuestion AUTO_ADDED = frozenset(BOOK_EXTENSIONS) - {'pdr', 'mbp', 'tan'} +class AllAllowed(object): + + def __init__(self): + self.disallowed = frozenset(gprefs['blocked_auto_formats']) + + def __contains__(self, x): + return x not in self.disallowed + class Worker(Thread): def __init__(self, path, callback): @@ -29,7 +37,10 @@ class Worker(Thread): self.wake_up = Event() self.path, self.callback = path, callback self.staging = set() - self.allowed = AUTO_ADDED - frozenset(gprefs['blocked_auto_formats']) + if gprefs['auto_add_everything']: + self.allowed = AllAllowed() + else: + self.allowed = AUTO_ADDED - frozenset(gprefs['blocked_auto_formats']) def run(self): self.tdir = PersistentTemporaryDirectory('_auto_adder') diff --git a/src/calibre/gui2/preferences/adding.py b/src/calibre/gui2/preferences/adding.py index eb7c34442f..1db4020063 100644 --- a/src/calibre/gui2/preferences/adding.py +++ b/src/calibre/gui2/preferences/adding.py @@ -38,6 +38,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form): r('new_book_tags', prefs, setting=CommaSeparatedList) r('mark_new_books', prefs) r('auto_add_path', gprefs, restart_required=True) + r('auto_add_everything', gprefs, restart_required=True) r('auto_add_check_for_duplicates', gprefs) r('auto_add_auto_convert', gprefs) diff --git a/src/calibre/gui2/preferences/adding.ui b/src/calibre/gui2/preferences/adding.ui index be4073d14c..874eac5a9c 100644 --- a/src/calibre/gui2/preferences/adding.ui +++ b/src/calibre/gui2/preferences/adding.ui @@ -173,6 +173,63 @@ Title match ignores leading indefinite articles ("the", "a", + + + By default, calibre will auto-add only known ebook files. +This option tells calibre to add all file types, except those +that have been explicitly ignored below. + + + Auto add files of &all types (not just ebooks) + + + + + + + + + Folder to auto-add files from + + + + + + + Browse for folder + + + ... + + + + :/images/document_open.png:/images/document_open.png + + + + + + + + + Automatically &convert added files to the current output format + + + + + + + Qt::Vertical + + + + 20 + 40 + + + + + @@ -228,7 +285,7 @@ Title match ignores leading indefinite articles ("the", "a", - + Qt::Horizontal @@ -241,51 +298,6 @@ Title match ignores leading indefinite articles ("the", "a", - - - - - - Folder to auto-add files from - - - - - - - Browse for folder - - - ... - - - - :/images/document_open.png:/images/document_open.png - - - - - - - - - Automatically &convert added files to the current output format - - - - - - - Qt::Vertical - - - - 20 - 40 - - - -