diff --git a/resources/default_tweaks.py b/resources/default_tweaks.py
index fb4fff9dc7..8d853deaa9 100644
--- a/resources/default_tweaks.py
+++ b/resources/default_tweaks.py
@@ -93,11 +93,6 @@ save_template_title_series_sorting = 'library_order'
auto_connect_to_folder = ''
-# Specify a tag to be automatically applied when a book is added to the library.
-# Example: add_tag_to_new_books='ToDo'
-add_tag_to_new_books = ''
-
-
# Create search terms to apply a query across several built-in search terms.
# Syntax: {'new term':['existing term 1', 'term 2', ...], 'new':['old'...] ...}
# Example: create the term 'myseries' that when used as myseries:foo would
diff --git a/src/calibre/gui2/dialogs/config/__init__.py b/src/calibre/gui2/dialogs/config/__init__.py
index 1f04c50e19..1dca3e28ff 100644
--- a/src/calibre/gui2/dialogs/config/__init__.py
+++ b/src/calibre/gui2/dialogs/config/__init__.py
@@ -457,6 +457,7 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
self.priority.setCurrentIndex(p)
self.priority.setVisible(iswindows)
self.priority_label.setVisible(iswindows)
+ self.new_book_tags.setText(prefs['new_book_tags'])
self._plugin_model = PluginModel()
self.plugin_view.setModel(self._plugin_model)
self.plugin_view.setStyleSheet(
@@ -906,6 +907,7 @@ class ConfigDialog(ResizableDialog, Ui_Dialog):
config['disable_tray_notification'] = not self.systray_notifications.isChecked()
p = {0:'normal', 1:'high', 2:'low'}[self.priority.currentIndex()]
prefs['worker_process_priority'] = p
+ prefs['new_book_tags'] = unicode(self.new_book_tags.text()).strip()
prefs['output_format'] = unicode(self.output_format.currentText()).upper()
config['cover_flow_queue_length'] = self.cover_browse.value()
prefs['language'] = str(self.language.itemData(self.language.currentIndex()).toString())
diff --git a/src/calibre/gui2/dialogs/config/config.ui b/src/calibre/gui2/dialogs/config/config.ui
index 988960615d..5a2bf805da 100644
--- a/src/calibre/gui2/dialogs/config/config.ui
+++ b/src/calibre/gui2/dialogs/config/config.ui
@@ -136,7 +136,7 @@
-
-
-
+
-
Default network &timeout:
@@ -146,7 +146,7 @@
- -
+
-
Set the default timeout for network fetches (i.e. anytime we go out to the internet to get information)
@@ -165,10 +165,10 @@
- -
+
-
- -
+
-
Choose &language (requires restart):
@@ -178,7 +178,7 @@
- -
+
-
-
@@ -197,7 +197,7 @@
- -
+
-
Job &priority:
@@ -207,7 +207,7 @@
- -
+
-
Preferred &output format:
@@ -217,9 +217,26 @@
- -
+
-
+ -
+
+
+ Tags to apply when adding a book:
+
+
+ new_book_tags
+
+
+
+ -
+
+
+ A comma-separated list of tags that will be applied to books added to the library
+
+
+
-
diff --git a/src/calibre/library/database2.py b/src/calibre/library/database2.py
index 91eafbaff0..76801a9893 100644
--- a/src/calibre/library/database2.py
+++ b/src/calibre/library/database2.py
@@ -1726,12 +1726,13 @@ class LibraryDatabase2(LibraryDatabase, SchemaUpgrade, CustomColumns):
return run_plugins_on_import(path, format)
def _add_newbook_tag(self, mi):
- tag = tweaks['add_tag_to_new_books']
- if tag:
- if mi.tags is None:
- mi.tags = [tag]
- else:
- mi.tags.append(tag)
+ tags = prefs['new_book_tags'].strip()
+ if tags:
+ for tag in [t.strip() for t in tags.split(',')]:
+ if mi.tags is None:
+ mi.tags = [tag]
+ else:
+ mi.tags.append(tag)
def create_book_entry(self, mi, cover=None, add_duplicates=True):
self._add_newbook_tag(mi)
diff --git a/src/calibre/utils/config.py b/src/calibre/utils/config.py
index a890d653b6..5682cab5e1 100644
--- a/src/calibre/utils/config.py
+++ b/src/calibre/utils/config.py
@@ -717,6 +717,7 @@ def _prefs():
c.add_opt('add_formats_to_existing', default=False,
help=_('Add new formats to existing book records'))
c.add_opt('installation_uuid', default=None, help='Installation UUID')
+ c.add_opt('new_book_tags', default='', help=_('Tags to apply to books added to the library'))
# these are here instead of the gui preferences because calibredb and
# calibre server can execute searches