mirror of
https://github.com/janeczku/calibre-web
synced 2024-06-26 15:13:17 +00:00
Accept multiple types for auto-conversion
This commit is contained in:
parent
665056c836
commit
7c133bf5c1
|
@ -1772,7 +1772,7 @@ def _configuration_update_helper():
|
||||||
reboot_required |= _config_checkbox_int(to_save, "config_kobo_sync")
|
reboot_required |= _config_checkbox_int(to_save, "config_kobo_sync")
|
||||||
_config_int(to_save, "config_external_port")
|
_config_int(to_save, "config_external_port")
|
||||||
_config_checkbox_int(to_save, "config_kobo_proxy")
|
_config_checkbox_int(to_save, "config_kobo_proxy")
|
||||||
_config_string(to_save, "config_auto_convert_to_format")
|
_config_string(to_save, "config_auto_convert_to_formats")
|
||||||
|
|
||||||
if "config_upload_formats" in to_save:
|
if "config_upload_formats" in to_save:
|
||||||
to_save["config_upload_formats"] = ','.join(
|
to_save["config_upload_formats"] = ','.join(
|
||||||
|
|
|
@ -144,7 +144,7 @@ class _Settings(_Base):
|
||||||
config_binariesdir = Column(String, default=None)
|
config_binariesdir = Column(String, default=None)
|
||||||
config_calibre = Column(String)
|
config_calibre = Column(String)
|
||||||
config_rarfile_location = Column(String, default=None)
|
config_rarfile_location = Column(String, default=None)
|
||||||
config_auto_convert_to_format = Column(String, default=None)
|
config_auto_convert_to_formats = Column(String, default=None)
|
||||||
config_upload_formats = Column(String, default=','.join(constants.EXTENSIONS_UPLOAD))
|
config_upload_formats = Column(String, default=','.join(constants.EXTENSIONS_UPLOAD))
|
||||||
config_unicode_filename = Column(Boolean, default=False)
|
config_unicode_filename = Column(Boolean, default=False)
|
||||||
config_embed_metadata = Column(Boolean, default=True)
|
config_embed_metadata = Column(Boolean, default=True)
|
||||||
|
|
|
@ -306,22 +306,22 @@ def upload():
|
||||||
helper.add_book_to_thumbnail_cache(book_id)
|
helper.add_book_to_thumbnail_cache(book_id)
|
||||||
|
|
||||||
book_format_from = meta.extension.upper()[1:]
|
book_format_from = meta.extension.upper()[1:]
|
||||||
if (
|
if (config.config_auto_convert_to_formats):
|
||||||
config.config_auto_convert_to_format and
|
for format in config.config_auto_convert_to_formats.split(','):
|
||||||
config.config_auto_convert_to_format.upper() != book_format_from
|
book_format_to = format.strip().upper()
|
||||||
):
|
if book_format_to == book_format_from:
|
||||||
book_format_to = config.config_auto_convert_to_format.upper()
|
continue
|
||||||
rtn = helper.convert_book_format(book_id,
|
rtn = helper.convert_book_format(book_id,
|
||||||
config.get_book_path(),
|
config.get_book_path(),
|
||||||
book_format_from,
|
book_format_from,
|
||||||
book_format_to,
|
book_format_to,
|
||||||
current_user.name)
|
current_user.name)
|
||||||
if rtn is None:
|
if rtn is None:
|
||||||
flash(_("Book successfully queued for converting to %(book_format)s",
|
flash(_("Book successfully queued for converting to %(book_format)s",
|
||||||
book_format=book_format_to),
|
book_format=book_format_to),
|
||||||
category="success")
|
category="success")
|
||||||
else:
|
else:
|
||||||
flash(_("There was an error converting this book: %(res)s", res=rtn), category="error")
|
flash(_("There was an error converting this book: %(res)s", res=rtn), category="error")
|
||||||
|
|
||||||
if len(request.files.getlist("btn-upload")) < 2:
|
if len(request.files.getlist("btn-upload")) < 2:
|
||||||
if current_user.role_edit() or current_user.role_admin():
|
if current_user.role_edit() or current_user.role_admin():
|
||||||
|
|
|
@ -112,13 +112,8 @@
|
||||||
<label for="config_uploading">{{_('Enable Uploads')}} {{_('(Please ensure that users also have upload permissions)')}}</label>
|
<label for="config_uploading">{{_('Enable Uploads')}} {{_('(Please ensure that users also have upload permissions)')}}</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="config_auto_convert_to_format">{{_('Automatically convert ebooks to format')}}</label>
|
<label for="config_auto_convert_to_format">{{_('Automatically convert ebooks to format (comma separated list)')}}</label>
|
||||||
<select name="config_auto_convert_to_format" id="config_auto_convert_to_format" class="form-control">
|
<input type="text" class="form-control" name="config_auto_convert_to_formats" id="config_auto_convert_to_formats" value="{% if config.config_auto_convert_to_formats != None %}{{ config.config_auto_convert_to_formats }}{% endif %}" autocomplete="off">
|
||||||
<option value="" {% if not config.config_auto_convert_to_format %} selected{% endif %}>Disable</option>
|
|
||||||
{% for format in config.config_upload_formats.split(",") %}
|
|
||||||
<option value="{{ format }}"{% if config.config_auto_convert_to_format and config.config_auto_convert_to_format.lower() == format.lower() %} selected{% endif %}>{{ format }}</option>
|
|
||||||
{% endfor %}
|
|
||||||
</select>
|
|
||||||
</div>
|
</div>
|
||||||
<div data-related="upload_settings">
|
<div data-related="upload_settings">
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
|
Loading…
Reference in New Issue
Block a user