mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
An option to auto-convert a book on adding even if it is already in the output format (Preferences->Adding Books). Fixes #1460477 [Request - automatic epub to epub conversion](https://bugs.launchpad.net/calibre/+bug/1460477)
This commit is contained in:
parent
28c92e572b
commit
f0cedba6c7
@ -102,6 +102,7 @@ defs['edit_metadata_single_layout'] = 'default'
|
||||
defs['default_author_link'] = 'https://en.wikipedia.org/w/index.php?search={author}'
|
||||
defs['preserve_date_on_ctl'] = True
|
||||
defs['manual_add_auto_convert'] = False
|
||||
defs['auto_convert_same_fmt'] = False
|
||||
defs['cb_fullscreen'] = False
|
||||
defs['worker_max_time'] = 0
|
||||
defs['show_files_after_save'] = True
|
||||
|
@ -10,7 +10,7 @@ from functools import partial
|
||||
|
||||
from PyQt5.Qt import QModelIndex, QTimer
|
||||
|
||||
from calibre.gui2 import error_dialog, Dispatcher
|
||||
from calibre.gui2 import error_dialog, Dispatcher, gprefs
|
||||
from calibre.gui2.tools import convert_single_ebook, convert_bulk_ebook
|
||||
from calibre.utils.config import prefs, tweaks
|
||||
from calibre.gui2.actions import InterfaceAction
|
||||
@ -87,7 +87,7 @@ class ConvertAction(InterfaceAction):
|
||||
for book_id in book_ids:
|
||||
fmts = db.formats(book_id, index_is_id=True)
|
||||
fmts = set(x.lower() for x in fmts.split(',')) if fmts else set()
|
||||
if of not in fmts:
|
||||
if gprefs['auto_convert_same_fmt'] or of not in fmts:
|
||||
needed.add(book_id)
|
||||
if needed:
|
||||
jobs, changed, bad = convert_single_ebook(self.gui,
|
||||
|
@ -41,6 +41,7 @@ class ConfigWidget(ConfigWidgetBase, Ui_Form):
|
||||
r('auto_add_everything', gprefs, restart_required=True)
|
||||
r('auto_add_check_for_duplicates', gprefs)
|
||||
r('auto_add_auto_convert', gprefs)
|
||||
r('auto_convert_same_fmt', gprefs)
|
||||
|
||||
self.filename_pattern = FilenamePattern(self)
|
||||
self.metadata_box.layout().insertWidget(0, self.filename_pattern)
|
||||
|
@ -51,7 +51,7 @@
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
<item row="6" column="0">
|
||||
<item row="7" column="0">
|
||||
<widget class="QLabel" name="label_230">
|
||||
<property name="text">
|
||||
<string>&Tags to apply when adding a book:</string>
|
||||
@ -61,14 +61,14 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="6" column="2">
|
||||
<item row="7" column="2">
|
||||
<widget class="QLineEdit" name="opt_new_book_tags">
|
||||
<property name="toolTip">
|
||||
<string>A comma-separated list of tags that will be applied to books added to the library</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="7" column="0" colspan="3">
|
||||
<item row="8" column="0" colspan="3">
|
||||
<widget class="QGroupBox" name="metadata_box">
|
||||
<property name="title">
|
||||
<string>&Configure metadata from file name</string>
|
||||
@ -104,7 +104,7 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="2">
|
||||
<item row="6" column="2">
|
||||
<widget class="QComboBox" name="opt_automerge">
|
||||
<property name="toolTip">
|
||||
<string>Automerge: If books with similar titles and authors found, merge the incoming formats automatically into
|
||||
@ -144,7 +144,7 @@ Author matching is exact.</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="2">
|
||||
<item row="6" column="0" colspan="2">
|
||||
<widget class="QCheckBox" name="opt_add_formats_to_existing">
|
||||
<property name="toolTip">
|
||||
<string>Automerge: If books with similar titles and authors found, merge the incoming formats automatically into
|
||||
@ -165,6 +165,16 @@ Title match ignores leading indefinite articles ("the", "a",
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="5" column="0" colspan="3">
|
||||
<widget class="QCheckBox" name="opt_auto_convert_same_fmt">
|
||||
<property name="toolTip">
|
||||
<string>This will force an automatic conversion even if the file being added is the same format as the output format. For example, if you set your output format to EPUB and add an EPUB file, an EPUB to EPUB conversion will be run.</string>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>When autoconverting, convert even if the format being added is the &same as the output format</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
<widget class="QWidget" name="tab_4">
|
||||
|
Loading…
x
Reference in New Issue
Block a user