diff --git a/cps/about.py b/cps/about.py index 438163ab..5ca2c68a 100644 --- a/cps/about.py +++ b/cps/about.py @@ -91,5 +91,6 @@ def stats(): series = db.session.query(db.Series).count() _VERSIONS['ebook converter'] = _(converter.get_calibre_version()) _VERSIONS['unrar'] = _(converter.get_unrar_version()) + _VERSIONS['kepubify'] = _(converter.get_kepubify_version()) return render_title_template('stats.html', bookcounter=counter, authorcounter=authors, versions=_VERSIONS, categorycounter=categorys, seriecounter=series, title=_(u"Statistics"), page="stat") diff --git a/cps/admin.py b/cps/admin.py index 4efd5bb5..340a4251 100644 --- a/cps/admin.py +++ b/cps/admin.py @@ -168,7 +168,6 @@ def update_view_configuration(): _config_string("config_calibre_web_title") _config_string("config_columns_to_ignore") - # _config_string("config_mature_content_tags") reboot_required |= _config_string("config_title_regex") _config_int("config_read_column") @@ -179,7 +178,8 @@ def update_view_configuration(): _config_int("config_restricted_column") if config.config_google_drive_watch_changes_response: - config.config_google_drive_watch_changes_response = json.dumps(config.config_google_drive_watch_changes_response) + config.config_google_drive_watch_changes_response = \ + json.dumps(config.config_google_drive_watch_changes_response) config.config_default_role = constants.selected_roles(to_save) config.config_default_role &= ~constants.ROLE_ANONYMOUS @@ -538,11 +538,6 @@ def _configuration_update_helper(): _config_string("config_converterpath") _config_string("config_kepubifypath") - - _config_checkbox_int("config_automatic_kepub") - _config_string("config_kepubify_path") - _config_string("config_kepub_cache_dir") - reboot_required |= _config_int("config_login_type") #LDAP configurator, @@ -579,11 +574,6 @@ def _configuration_update_helper(): if not config.config_ldap_serv_username: return _configuration_result('Please Enter a LDAP Service Account', gdriveError) - #_config_checkbox("config_ldap_use_ssl") - #_config_checkbox("config_ldap_use_tls") - # reboot_required |= _config_checkbox("config_ldap_openldap") - # _config_checkbox("config_ldap_require_cert") - if config.config_ldap_group_object_filter: if config.config_ldap_group_object_filter.count("%s") != 1: return _configuration_result(_('LDAP Group Object Filter Needs to Have One "%s" Format Identifier'), diff --git a/cps/constants.py b/cps/constants.py index 73072d83..11681b46 100644 --- a/cps/constants.py +++ b/cps/constants.py @@ -81,9 +81,10 @@ SIDEBAR_PUBLISHER = 1 << 12 SIDEBAR_RATING = 1 << 13 SIDEBAR_FORMAT = 1 << 14 SIDEBAR_ARCHIVED = 1 << 15 +SIDEBAR_LIST = 1 << 16 ADMIN_USER_ROLES = sum(r for r in ALL_ROLES.values()) & ~ROLE_ANONYMOUS -ADMIN_USER_SIDEBAR = (SIDEBAR_ARCHIVED << 1) - 1 +ADMIN_USER_SIDEBAR = (SIDEBAR_LIST << 1) - 1 UPDATE_STABLE = 0 << 0 AUTO_UPDATE_STABLE = 1 << 0 @@ -111,9 +112,9 @@ del env_CALIBRE_PORT EXTENSIONS_AUDIO = {'mp3', 'm4a', 'm4b'} -EXTENSIONS_CONVERT = {'pdf', 'epub', 'mobi', 'azw3', 'docx', 'rtf', 'fb2', 'lit', 'lrf', 'txt', 'htmlz', 'rtf', 'odt'} -EXTENSIONS_UPLOAD = {'txt', 'pdf', 'epub', 'mobi', 'azw', 'azw3', 'cbr', 'cbz', 'cbt', 'djvu', 'prc', 'doc', 'docx', - 'fb2', 'html', 'rtf', 'lit', 'odt', 'mp3', 'm4a', 'm4b'} +EXTENSIONS_CONVERT = ['pdf', 'epub', 'mobi', 'azw3', 'docx', 'rtf', 'fb2', 'lit', 'lrf', 'txt', 'htmlz', 'rtf', 'odt'] +EXTENSIONS_UPLOAD = {'txt', 'pdf', 'epub', 'kepub', 'mobi', 'azw', 'azw3', 'cbr', 'cbz', 'cbt', 'djvu', 'prc', 'doc', + 'docx', 'fb2', 'html', 'rtf', 'lit', 'odt', 'mp3', 'm4a', 'm4b'} def has_flag(value, bit_flag): diff --git a/cps/converter.py b/cps/converter.py index 99ac3a3e..01a6fbc7 100644 --- a/cps/converter.py +++ b/cps/converter.py @@ -19,6 +19,7 @@ from __future__ import division, print_function, unicode_literals import os import re +import sys from flask_babel import gettext as _ from . import config, logger @@ -49,11 +50,14 @@ def _get_command_version(path, pattern, argument=None): def get_calibre_version(): - # version = None - # if config.config_ebookconverter == 2: return _get_command_version(config.config_converterpath, r'ebook-convert.*\(calibre', '--version') \ or _NOT_CONFIGURED def get_unrar_version(): return _get_command_version(config.config_rarfile_location, r'UNRAR.*\d') or _NOT_CONFIGURED + +def get_kepubify_version(): + return _get_command_version(config.config_kepubifypath, r'kepubify\s','--version') or _NOT_CONFIGURED + + diff --git a/cps/helper.py b/cps/helper.py index d254a669..981fbc20 100644 --- a/cps/helper.py +++ b/cps/helper.py @@ -609,14 +609,8 @@ def do_download_file(book, book_format, client, data, headers): # ToDo: improve error handling log.error('File not found: %s', os.path.join(filename, data.name + "." + book_format)) - if client == "kobo" and book_format == "epub": - filename = config.config_kepub_cache_dir - os.system('{0} "{1}" -o {2}'.format( - config.config_kepubify_path, - os.path.join(filename, data.name + "." + book_format), - filename)) - book_format = "kepub.epub" - headers["Content-Disposition"] = headers["Content-Disposition"].replace(".epub", ".kepub.epub") + if client == "kobo" and book_format == "kepub": + headers["Content-Disposition"] = headers["Content-Disposition"].replace(".kepub", ".kepub.epub") response = make_response(send_from_directory(filename, data.name + "." + book_format)) diff --git a/cps/templates/config_edit.html b/cps/templates/config_edit.html index 9fded88e..a9fb23b0 100644 --- a/cps/templates/config_edit.html +++ b/cps/templates/config_edit.html @@ -345,17 +345,17 @@
+ {% endif %}