Improvements

pull/1409/head
Ozzieisaacs 5 years ago
parent ff75bdba9e
commit 0a02caad04

@ -91,5 +91,6 @@ def stats():
series = db.session.query(db.Series).count() series = db.session.query(db.Series).count()
_VERSIONS['ebook converter'] = _(converter.get_calibre_version()) _VERSIONS['ebook converter'] = _(converter.get_calibre_version())
_VERSIONS['unrar'] = _(converter.get_unrar_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, return render_title_template('stats.html', bookcounter=counter, authorcounter=authors, versions=_VERSIONS,
categorycounter=categorys, seriecounter=series, title=_(u"Statistics"), page="stat") categorycounter=categorys, seriecounter=series, title=_(u"Statistics"), page="stat")

@ -168,7 +168,6 @@ def update_view_configuration():
_config_string("config_calibre_web_title") _config_string("config_calibre_web_title")
_config_string("config_columns_to_ignore") _config_string("config_columns_to_ignore")
# _config_string("config_mature_content_tags")
reboot_required |= _config_string("config_title_regex") reboot_required |= _config_string("config_title_regex")
_config_int("config_read_column") _config_int("config_read_column")
@ -179,7 +178,8 @@ def update_view_configuration():
_config_int("config_restricted_column") _config_int("config_restricted_column")
if config.config_google_drive_watch_changes_response: 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.selected_roles(to_save)
config.config_default_role &= ~constants.ROLE_ANONYMOUS config.config_default_role &= ~constants.ROLE_ANONYMOUS
@ -538,11 +538,6 @@ def _configuration_update_helper():
_config_string("config_converterpath") _config_string("config_converterpath")
_config_string("config_kepubifypath") _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") reboot_required |= _config_int("config_login_type")
#LDAP configurator, #LDAP configurator,
@ -579,11 +574,6 @@ def _configuration_update_helper():
if not config.config_ldap_serv_username: if not config.config_ldap_serv_username:
return _configuration_result('Please Enter a LDAP Service Account', gdriveError) 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:
if config.config_ldap_group_object_filter.count("%s") != 1: if config.config_ldap_group_object_filter.count("%s") != 1:
return _configuration_result(_('LDAP Group Object Filter Needs to Have One "%s" Format Identifier'), return _configuration_result(_('LDAP Group Object Filter Needs to Have One "%s" Format Identifier'),

@ -81,9 +81,10 @@ SIDEBAR_PUBLISHER = 1 << 12
SIDEBAR_RATING = 1 << 13 SIDEBAR_RATING = 1 << 13
SIDEBAR_FORMAT = 1 << 14 SIDEBAR_FORMAT = 1 << 14
SIDEBAR_ARCHIVED = 1 << 15 SIDEBAR_ARCHIVED = 1 << 15
SIDEBAR_LIST = 1 << 16
ADMIN_USER_ROLES = sum(r for r in ALL_ROLES.values()) & ~ROLE_ANONYMOUS 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 UPDATE_STABLE = 0 << 0
AUTO_UPDATE_STABLE = 1 << 0 AUTO_UPDATE_STABLE = 1 << 0
@ -111,9 +112,9 @@ del env_CALIBRE_PORT
EXTENSIONS_AUDIO = {'mp3', 'm4a', 'm4b'} EXTENSIONS_AUDIO = {'mp3', 'm4a', 'm4b'}
EXTENSIONS_CONVERT = {'pdf', 'epub', 'mobi', 'azw3', 'docx', 'rtf', 'fb2', 'lit', 'lrf', 'txt', 'htmlz', 'rtf', 'odt'} 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', EXTENSIONS_UPLOAD = {'txt', 'pdf', 'epub', 'kepub', 'mobi', 'azw', 'azw3', 'cbr', 'cbz', 'cbt', 'djvu', 'prc', 'doc',
'fb2', 'html', 'rtf', 'lit', 'odt', 'mp3', 'm4a', 'm4b'} 'docx', 'fb2', 'html', 'rtf', 'lit', 'odt', 'mp3', 'm4a', 'm4b'}
def has_flag(value, bit_flag): def has_flag(value, bit_flag):

@ -19,6 +19,7 @@
from __future__ import division, print_function, unicode_literals from __future__ import division, print_function, unicode_literals
import os import os
import re import re
import sys
from flask_babel import gettext as _ from flask_babel import gettext as _
from . import config, logger from . import config, logger
@ -49,11 +50,14 @@ def _get_command_version(path, pattern, argument=None):
def get_calibre_version(): def get_calibre_version():
# version = None
# if config.config_ebookconverter == 2:
return _get_command_version(config.config_converterpath, r'ebook-convert.*\(calibre', '--version') \ return _get_command_version(config.config_converterpath, r'ebook-convert.*\(calibre', '--version') \
or _NOT_CONFIGURED or _NOT_CONFIGURED
def get_unrar_version(): def get_unrar_version():
return _get_command_version(config.config_rarfile_location, r'UNRAR.*\d') or _NOT_CONFIGURED 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

@ -609,14 +609,8 @@ def do_download_file(book, book_format, client, data, headers):
# ToDo: improve error handling # ToDo: improve error handling
log.error('File not found: %s', os.path.join(filename, data.name + "." + book_format)) log.error('File not found: %s', os.path.join(filename, data.name + "." + book_format))
if client == "kobo" and book_format == "epub": if client == "kobo" and book_format == "kepub":
filename = config.config_kepub_cache_dir headers["Content-Disposition"] = headers["Content-Disposition"].replace(".kepub", ".kepub.epub")
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")
response = make_response(send_from_directory(filename, data.name + "." + book_format)) response = make_response(send_from_directory(filename, data.name + "." + book_format))

@ -345,10 +345,6 @@
</div> </div>
<div id="collapseeight" class="panel-collapse collapse"> <div id="collapseeight" class="panel-collapse collapse">
<div class="panel-body"> <div class="panel-body">
<div class="form-group">
<label for="config_calibre">{{_('Calibre E-Book Converter Settings')}}</label>
<input type="text" class="form-control" id="config_calibre" name="config_calibre" value="{% if config.config_calibre != None %}{{ config.config_calibre }}{% endif %}" autocomplete="off">
</div>
<label for="config_converterpath">{{_('Path to Calibre E-Book Converter')}}</label> <label for="config_converterpath">{{_('Path to Calibre E-Book Converter')}}</label>
<div class="form-group input-group"> <div class="form-group input-group">
<input type="text" class="form-control" id="config_converterpath" name="config_converterpath" value="{% if config.config_converterpath != None %}{{ config.config_converterpath }}{% endif %}" autocomplete="off"> <input type="text" class="form-control" id="config_converterpath" name="config_converterpath" value="{% if config.config_converterpath != None %}{{ config.config_converterpath }}{% endif %}" autocomplete="off">
@ -356,6 +352,10 @@
<button type="button" id="converter_path" class="btn btn-default"><span class="glyphicon glyphicon-folder-open"></span></button> <button type="button" id="converter_path" class="btn btn-default"><span class="glyphicon glyphicon-folder-open"></span></button>
</span> </span>
</div> </div>
<div class="form-group">
<label for="config_calibre">{{_('Calibre E-Book Converter Settings')}}</label>
<input type="text" class="form-control" id="config_calibre" name="config_calibre" value="{% if config.config_calibre != None %}{{ config.config_calibre }}{% endif %}" autocomplete="off">
</div>
<label for="config_kepubifypath">{{_('Path to Kepubify E-Book Converter')}}</label> <label for="config_kepubifypath">{{_('Path to Kepubify E-Book Converter')}}</label>
<div class="form-group input-group"> <div class="form-group input-group">
<input type="text" class="form-control" id="config_kepubifypath" name="config_kepubifypath" value="{% if config.config_kepubifypath != None %}{{ config.config_kepubifypath }}{% endif %}" autocomplete="off"> <input type="text" class="form-control" id="config_kepubifypath" name="config_kepubifypath" value="{% if config.config_kepubifypath != None %}{{ config.config_kepubifypath }}{% endif %}" autocomplete="off">
@ -363,18 +363,6 @@
<button type="button" id="kepubify_path" class="btn btn-default"><span class="glyphicon glyphicon-folder-open"></span></button> <button type="button" id="kepubify_path" class="btn btn-default"><span class="glyphicon glyphicon-folder-open"></span></button>
</span> </span>
</div> </div>
<div class="form-group">
<input type="checkbox" id="config_automatic_kepub" name="config_automatic_kepub" {% if config.config_automatic_kepub %}checked{% endif %}>
<label for="config_uploading">{{_('Enable automatic kobo epub conversion')}}</label>
</div>
<div class="form-group">
<label for="config_kepubify_path">{{_('Path to kepubify')}}</label>
<input type="text" class="form-control" id="config_kepubify_path" name="config_kepubify_path" value="{% if config.config_kepubify_path != None %}{{ config.config_kepubify_path }}{% endif %}" autocomplete="off">
</div>
<div class="form-group">
<label for="config_kepub_cache_dir">{{_('Path to kepubify')}}</label>
<input type="text" class="form-control" id="config_kepub_cache_dir" name="config_kepub_cache_dir" value="{% if config.config_kepub_cache_dir != None %}{{ config.config_kepub_cache_dir }}{% endif %}" autocomplete="off">
</div>
{% if feature_support['rar'] %} {% if feature_support['rar'] %}
<label for="config_rarfile_location">{{_('Location of Unrar binary')}}</label> <label for="config_rarfile_location">{{_('Location of Unrar binary')}}</label>
<div class="form-group input-group"> <div class="form-group input-group">

@ -202,6 +202,7 @@
</label> </label>
</form> </form>
</p> </p>
{% if g.user.check_visibility(32768) %}
<p> <p>
<form id="archived_form" action="{{ url_for('web.toggle_archived', book_id=entry.id)}}" method="POST"> <form id="archived_form" action="{{ url_for('web.toggle_archived', book_id=entry.id)}}" method="POST">
<label class="block-label"> <label class="block-label">
@ -210,6 +211,7 @@
</label> </label>
</form> </form>
</p> </p>
{% endif %}
</div> </div>
{% endif %} {% endif %}

@ -79,11 +79,13 @@ def process(tmp_file_path, original_file_name, original_file_extension, rarExcec
try: try:
if ".PDF" == original_file_extension.upper(): if ".PDF" == original_file_extension.upper():
meta = pdf_meta(tmp_file_path, original_file_name, original_file_extension) 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) 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) 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, meta = comic.get_comic_info(tmp_file_path,
original_file_name, original_file_name,
original_file_extension, original_file_extension,

@ -814,6 +814,12 @@ def render_language_books(page, name, order):
title=_(u"Language: %(name)s", name=lang_name), page="language") 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") @web.route("/author")
@login_required_if_no_ano @login_required_if_no_ano
def author_list(): def author_list():
@ -1233,8 +1239,7 @@ def serve_book(book_id, book_format, anyname):
@login_required_if_no_ano @login_required_if_no_ano
@download_required @download_required
def download_link(book_id, book_format, anyname): def download_link(book_id, book_format, anyname):
if (config.config_automatic_kepub and if "Kobo" in request.headers.get('User-Agent'):
"Kobo" in request.headers.get('User-Agent')):
client = "kobo" client = "kobo"
return get_download_link(book_id, book_format, client) return get_download_link(book_id, book_format, client)

Loading…
Cancel
Save