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 @@
-
- - -
- +
-
+
+
+ + +
@@ -363,18 +363,6 @@
-
- - -
-
- - -
-
- - -
{% if feature_support['rar'] %}
diff --git a/cps/templates/detail.html b/cps/templates/detail.html index 8315a8f2..196e6885 100644 --- a/cps/templates/detail.html +++ b/cps/templates/detail.html @@ -202,6 +202,7 @@

+ {% if g.user.check_visibility(32768) %}

+ {% endif %}
{% endif %} diff --git a/cps/uploader.py b/cps/uploader.py index 880df20e..b6d4f4c5 100644 --- a/cps/uploader.py +++ b/cps/uploader.py @@ -79,11 +79,13 @@ def process(tmp_file_path, original_file_name, original_file_extension, rarExcec try: if ".PDF" == original_file_extension.upper(): meta = pdf_meta(tmp_file_path, original_file_name, original_file_extension) - if ".EPUB" == original_file_extension.upper() and use_epub_meta is True: + elif ".EPUB" == original_file_extension.upper() and use_epub_meta is True: meta = epub.get_epub_info(tmp_file_path, original_file_name, original_file_extension) - if ".FB2" == original_file_extension.upper() and use_fb2_meta is True: + elif ".KEPUB" == original_file_extension.upper() and use_epub_meta is True: + meta = epub.get_epub_info(tmp_file_path, original_file_name, original_file_extension) + elif ".FB2" == original_file_extension.upper() and use_fb2_meta is True: meta = fb2.get_fb2_info(tmp_file_path, original_file_extension) - if original_file_extension.upper() in ['.CBZ', '.CBT', '.CBR']: + elif original_file_extension.upper() in ['.CBZ', '.CBT', '.CBR']: meta = comic.get_comic_info(tmp_file_path, original_file_name, original_file_extension, diff --git a/cps/web.py b/cps/web.py index 694d95c5..beb34887 100644 --- a/cps/web.py +++ b/cps/web.py @@ -814,6 +814,12 @@ def render_language_books(page, name, order): title=_(u"Language: %(name)s", name=lang_name), page="language") +@web.route("/table") +@login_required_if_no_ano +def books_table(): + return render_title_template('index.html', random=random, entries=entries, pagination=pagination, id=name, + title=_(u"Language: %(name)s", name=lang_name), page="language") + @web.route("/author") @login_required_if_no_ano def author_list(): @@ -1233,8 +1239,7 @@ def serve_book(book_id, book_format, anyname): @login_required_if_no_ano @download_required def download_link(book_id, book_format, anyname): - if (config.config_automatic_kepub and - "Kobo" in request.headers.get('User-Agent')): + if "Kobo" in request.headers.get('User-Agent'): client = "kobo" return get_download_link(book_id, book_format, client)