mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-24 10:37:23 +00:00
Improvements
This commit is contained in:
parent
ff75bdba9e
commit
0a02caad04
@ -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")
|
||||
|
14
cps/admin.py
14
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'),
|
||||
|
@ -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):
|
||||
|
@ -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
|
||||
|
||||
|
||||
|
@ -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))
|
||||
|
||||
|
@ -345,17 +345,17 @@
|
||||
</div>
|
||||
<div id="collapseeight" class="panel-collapse collapse">
|
||||
<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">
|
||||
<input type="text" class="form-control" id="config_converterpath" name="config_converterpath" value="{% if config.config_converterpath != None %}{{ config.config_converterpath }}{% endif %}" autocomplete="off">
|
||||
<span class="input-group-btn">
|
||||
<button type="button" id="converter_path" class="btn btn-default"><span class="glyphicon glyphicon-folder-open"></span></button>
|
||||
</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>
|
||||
<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">
|
||||
@ -363,18 +363,6 @@
|
||||
<button type="button" id="kepubify_path" class="btn btn-default"><span class="glyphicon glyphicon-folder-open"></span></button>
|
||||
</span>
|
||||
</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'] %}
|
||||
<label for="config_rarfile_location">{{_('Location of Unrar binary')}}</label>
|
||||
<div class="form-group input-group">
|
||||
|
@ -202,6 +202,7 @@
|
||||
</label>
|
||||
</form>
|
||||
</p>
|
||||
{% if g.user.check_visibility(32768) %}
|
||||
<p>
|
||||
<form id="archived_form" action="{{ url_for('web.toggle_archived', book_id=entry.id)}}" method="POST">
|
||||
<label class="block-label">
|
||||
@ -210,6 +211,7 @@
|
||||
</label>
|
||||
</form>
|
||||
</p>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user