Eenabled send epubs to E-Reader devices

This commit is contained in:
Ozzie Isaacs 2022-05-08 12:55:54 +02:00
parent c1f1952b04
commit fbac3e38ac
12 changed files with 358 additions and 604 deletions

4
README.md Normal file → Executable file
View file

@ -28,7 +28,7 @@ Calibre-Web is a web app providing a clean interface for browsing, reading and d
- Support for converting eBooks through Calibre binaries - Support for converting eBooks through Calibre binaries
- Restrict eBook download to logged-in users - Restrict eBook download to logged-in users
- Support for public user registration - Support for public user registration
- Send eBooks to Kindle devices with the click of a button - Send eBooks to E-Readers with the click of a button
- Sync your Kobo devices through Calibre-Web with your Calibre library - Sync your Kobo devices through Calibre-Web with your Calibre library
- Support for reading eBooks directly in the browser (.txt, .epub, .pdf, .cbr, .cbt, .cbz, .djvu) - Support for reading eBooks directly in the browser (.txt, .epub, .pdf, .cbr, .cbt, .cbz, .djvu)
- Upload new books in many formats, including audio formats (.mp3, .m4a, .m4b) - Upload new books in many formats, including audio formats (.mp3, .m4a, .m4b)
@ -65,7 +65,7 @@ Afterwards you can configure your Calibre-Web instance ([Basic Configuration](ht
python 3.5+ python 3.5+
Optionally, to enable on-the-fly conversion from one ebook format to another when using the send-to-kindle feature, or during editing of ebooks metadata: Optionally, to enable on-the-fly conversion from one ebook format to another when using the send-to-ereader feature, or during editing of ebooks metadata:
[Download and install](https://calibre-ebook.com/download) the Calibre desktop program for your platform and enter the folder including program name (normally /opt/calibre/ebook-convert, or C:\Program Files\calibre\ebook-convert.exe) in the field "calibre's converter tool" on the setup page. [Download and install](https://calibre-ebook.com/download) the Calibre desktop program for your platform and enter the folder including program name (normally /opt/calibre/ebook-convert, or C:\Program Files\calibre\ebook-convert.exe) in the field "calibre's converter tool" on the setup page.

6
cps/admin.py Normal file → Executable file
View file

@ -1521,11 +1521,11 @@ def ldap_import_create_user(user, user_data):
log.warning("LDAP User %s Already in Database", user_data) log.warning("LDAP User %s Already in Database", user_data)
return 0, None return 0, None
kindlemail = '' ereader_mail = ''
if 'mail' in user_data: if 'mail' in user_data:
useremail = user_data['mail'][0].decode('utf-8') useremail = user_data['mail'][0].decode('utf-8')
if len(user_data['mail']) > 1: if len(user_data['mail']) > 1:
kindlemail = user_data['mail'][1].decode('utf-8') ereader_mail = user_data['mail'][1].decode('utf-8')
else: else:
log.debug('No Mail Field Found in LDAP Response') log.debug('No Mail Field Found in LDAP Response')
@ -1541,7 +1541,7 @@ def ldap_import_create_user(user, user_data):
content.name = username content.name = username
content.password = '' # dummy password which will be replaced by ldap one content.password = '' # dummy password which will be replaced by ldap one
content.email = useremail content.email = useremail
content.kindle_mail = kindlemail content.kindle_mail = ereader_mail
content.default_language = config.config_default_language content.default_language = config.config_default_language
content.locale = config.config_default_locale content.locale = config.config_default_locale
content.role = config.config_default_role content.role = config.config_default_role

66
cps/helper.py Normal file → Executable file
View file

@ -72,7 +72,7 @@ except (ImportError, RuntimeError) as e:
# Convert existing book entry to new format # Convert existing book entry to new format
def convert_book_format(book_id, calibre_path, old_book_format, new_book_format, user_id, kindle_mail=None): def convert_book_format(book_id, calibre_path, old_book_format, new_book_format, user_id, ereader_mail=None):
book = calibre_db.get_book(book_id) book = calibre_db.get_book(book_id)
data = calibre_db.get_book_format(book.id, old_book_format) data = calibre_db.get_book_format(book.id, old_book_format)
file_path = os.path.join(calibre_path, book.path, data.name) file_path = os.path.join(calibre_path, book.path, data.name)
@ -91,9 +91,9 @@ def convert_book_format(book_id, calibre_path, old_book_format, new_book_format,
format=old_book_format, fn=data.name + "." + old_book_format.lower()) format=old_book_format, fn=data.name + "." + old_book_format.lower())
return error_message return error_message
# read settings and append converter task to queue # read settings and append converter task to queue
if kindle_mail: if ereader_mail:
settings = config.get_mail_settings() settings = config.get_mail_settings()
settings['subject'] = _('Send to Kindle') # pretranslate Subject for e-mail settings['subject'] = _('Send to E-Reader') # pretranslate Subject for e-mail
settings['body'] = _(u'This e-mail has been sent via Calibre-Web.') settings['body'] = _(u'This e-mail has been sent via Calibre-Web.')
else: else:
settings = dict() settings = dict()
@ -104,14 +104,14 @@ def convert_book_format(book_id, calibre_path, old_book_format, new_book_format,
link) link)
settings['old_book_format'] = old_book_format settings['old_book_format'] = old_book_format
settings['new_book_format'] = new_book_format settings['new_book_format'] = new_book_format
WorkerThread.add(user_id, TaskConvert(file_path, book.id, txt, settings, kindle_mail, user_id)) WorkerThread.add(user_id, TaskConvert(file_path, book.id, txt, settings, ereader_mail, user_id))
return None return None
# Texts are not lazy translated as they are supposed to get send out as is # Texts are not lazy translated as they are supposed to get send out as is
def send_test_mail(kindle_mail, user_name): def send_test_mail(ereader_mail, user_name):
WorkerThread.add(user_name, TaskEmail(_(u'Calibre-Web test e-mail'), None, None, WorkerThread.add(user_name, TaskEmail(_(u'Calibre-Web test e-mail'), None, None,
config.get_mail_settings(), kindle_mail, N_(u"Test e-mail"), config.get_mail_settings(), ereader_mail, N_(u"Test e-mail"),
_(u'This e-mail has been sent via Calibre-Web.'))) _(u'This e-mail has been sent via Calibre-Web.')))
return return
@ -139,26 +139,26 @@ def send_registration_mail(e_mail, user_name, default_password, resend=False):
return return
def check_send_to_kindle_with_converter(formats): def check_send_to_ereader_with_converter(formats):
book_formats = list() book_formats = list()
if 'EPUB' in formats and 'MOBI' not in formats: if 'EPUB' in formats and 'EPUB' not in formats:
book_formats.append({'format': 'Mobi', book_formats.append({'format': 'Epub',
'convert': 1, 'convert': 1,
'text': _('Convert %(orig)s to %(format)s and send to Kindle', 'text': _('Convert %(orig)s to %(format)s and send to E-Reader',
orig='Epub', orig='Mobi',
format='Mobi')}) format='Epub')})
if 'AZW3' in formats and 'MOBI' not in formats: if 'AZW3' in formats and 'EPUB' not in formats:
book_formats.append({'format': 'Mobi', book_formats.append({'format': 'Epub',
'convert': 2, 'convert': 2,
'text': _('Convert %(orig)s to %(format)s and send to Kindle', 'text': _('Convert %(orig)s to %(format)s and send to E-Reader',
orig='Azw3', orig='Azw3',
format='Mobi')}) format='Epub')})
return book_formats return book_formats
def check_send_to_kindle(entry): def check_send_to_ereader(entry):
""" """
returns all available book formats for sending to Kindle returns all available book formats for sending to E-Reader
""" """
formats = list() formats = list()
book_formats = list() book_formats = list()
@ -166,20 +166,24 @@ def check_send_to_kindle(entry):
for ele in iter(entry.data): for ele in iter(entry.data):
if ele.uncompressed_size < config.mail_size: if ele.uncompressed_size < config.mail_size:
formats.append(ele.format) formats.append(ele.format)
if 'EPUB' in formats:
book_formats.append({'format': 'Epub',
'convert': 0,
'text': _('Send %(format)s to E-Reader', format='Epub')})
if 'MOBI' in formats: if 'MOBI' in formats:
book_formats.append({'format': 'Mobi', book_formats.append({'format': 'Mobi',
'convert': 0, 'convert': 0,
'text': _('Send %(format)s to Kindle', format='Mobi')}) 'text': _('Send %(format)s to E-Reader', format='Mobi')})
if 'PDF' in formats: if 'PDF' in formats:
book_formats.append({'format': 'Pdf', book_formats.append({'format': 'Pdf',
'convert': 0, 'convert': 0,
'text': _('Send %(format)s to Kindle', format='Pdf')}) 'text': _('Send %(format)s to E-Reader', format='Pdf')})
if 'AZW' in formats: if 'AZW' in formats:
book_formats.append({'format': 'Azw', book_formats.append({'format': 'Azw',
'convert': 0, 'convert': 0,
'text': _('Send %(format)s to Kindle', format='Azw')}) 'text': _('Send %(format)s to E-Reader', format='Azw')})
if config.config_converterpath: if config.config_converterpath:
book_formats.extend(check_send_to_kindle_with_converter(formats)) book_formats.extend(check_send_to_ereader_with_converter(formats))
return book_formats return book_formats
else: else:
log.error(u'Cannot find book entry %d', entry.id) log.error(u'Cannot find book entry %d', entry.id)
@ -199,27 +203,27 @@ def check_read_formats(entry):
# Files are processed in the following order/priority: # Files are processed in the following order/priority:
# 1: If Mobi file is existing, it's directly send to kindle email, # 1: If Mobi file is existing, it's directly send to E-Reader email,
# 2: If Epub file is existing, it's converted and send to kindle email, # 2: If Epub file is existing, it's converted and send to E-Reader email,
# 3: If Pdf file is existing, it's directly send to kindle email # 3: If Pdf file is existing, it's directly send to E-Reader email
def send_mail(book_id, book_format, convert, kindle_mail, calibrepath, user_id): def send_mail(book_id, book_format, convert, ereader_mail, calibrepath, user_id):
"""Send email with attachments""" """Send email with attachments"""
book = calibre_db.get_book(book_id) book = calibre_db.get_book(book_id)
if convert == 1: if convert == 1:
# returns None if success, otherwise errormessage # returns None if success, otherwise errormessage
return convert_book_format(book_id, calibrepath, u'epub', book_format.lower(), user_id, kindle_mail) return convert_book_format(book_id, calibrepath, u'epub', book_format.lower(), user_id, ereader_mail)
if convert == 2: if convert == 2:
# returns None if success, otherwise errormessage # returns None if success, otherwise errormessage
return convert_book_format(book_id, calibrepath, u'azw3', book_format.lower(), user_id, kindle_mail) return convert_book_format(book_id, calibrepath, u'azw3', book_format.lower(), user_id, ereader_mail)
for entry in iter(book.data): for entry in iter(book.data):
if entry.format.upper() == book_format.upper(): if entry.format.upper() == book_format.upper():
converted_file_name = entry.name + '.' + book_format.lower() converted_file_name = entry.name + '.' + book_format.lower()
link = '<a href="{}">{}</a>'.format(url_for('web.show_book', book_id=book_id), escape(book.title)) link = '<a href="{}">{}</a>'.format(url_for('web.show_book', book_id=book_id), escape(book.title))
email_text = N_(u"%(book)s send to Kindle", book=link) email_text = N_(u"%(book)s send to E-Reader", book=link)
WorkerThread.add(user_id, TaskEmail(_(u"Send to Kindle"), book.path, converted_file_name, WorkerThread.add(user_id, TaskEmail(_(u"Send to E-Reader"), book.path, converted_file_name,
config.get_mail_settings(), kindle_mail, config.get_mail_settings(), ereader_mail,
email_text, _(u'This e-mail has been sent via Calibre-Web.'))) email_text, _(u'This e-mail has been sent via Calibre-Web.')))
return return
return _(u"The requested file could not be read. Maybe wrong permissions?") return _(u"The requested file could not be read. Maybe wrong permissions?")

16
cps/static/js/caliBlur.js Normal file → Executable file
View file

@ -201,7 +201,7 @@ if ($("body.book").length > 0) {
// Move dropdown lists higher in dom, replace bootstrap toggle with own toggle. // Move dropdown lists higher in dom, replace bootstrap toggle with own toggle.
$('ul[aria-labelledby="read-in-browser"]').insertBefore(".blur-wrapper").addClass("readinbrowser-drop"); $('ul[aria-labelledby="read-in-browser"]').insertBefore(".blur-wrapper").addClass("readinbrowser-drop");
$('ul[aria-labelledby="send-to-kindle"]').insertBefore(".blur-wrapper").addClass("sendtokindle-drop"); $('ul[aria-labelledby="send-to-kereader"]').insertBefore(".blur-wrapper").addClass("sendtoereader-drop");
$(".leramslist").insertBefore(".blur-wrapper"); $(".leramslist").insertBefore(".blur-wrapper");
$('ul[aria-labelledby="btnGroupDrop1"]').insertBefore(".blur-wrapper").addClass("leramslist"); $('ul[aria-labelledby="btnGroupDrop1"]').insertBefore(".blur-wrapper").addClass("leramslist");
$("#add-to-shelves").insertBefore(".blur-wrapper"); $("#add-to-shelves").insertBefore(".blur-wrapper");
@ -215,7 +215,7 @@ if ($("body.book").length > 0) {
}); });
$("#sendbtn2").click(function () { $("#sendbtn2").click(function () {
$(".sendtokindle-drop").toggle(); $(".sendtoereader-drop").toggle();
}); });
@ -242,12 +242,12 @@ if ($("body.book").length > 0) {
if ($("#sendbtn2").length > 0) { if ($("#sendbtn2").length > 0) {
position = $("#sendbtn2").offset().left position = $("#sendbtn2").offset().left
if (position + $(".sendtokindle-drop").width() > $(window).width()) { if (position + $(".sendtoereader-drop").width() > $(window).width()) {
positionOff = position + $(".sendtokindle-drop").width() - $(window).width(); positionOff = position + $(".sendtoereader-drop").width() - $(window).width();
ribPosition = position - positionOff - 5 ribPosition = position - positionOff - 5
$(".sendtokindle-drop").attr("style", "left: " + ribPosition + "px !important; right: auto; top: " + topPos + "px"); $(".sendtoereader-drop").attr("style", "left: " + ribPosition + "px !important; right: auto; top: " + topPos + "px");
} else { } else {
$(".sendtokindle-drop").attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px"); $(".sendtoereader-drop").attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
} }
} }
@ -300,7 +300,7 @@ if ($("body.book").length > 0) {
$(document).mouseup(function (e) { $(document).mouseup(function (e) {
var container = new Array(); var container = new Array();
container.push($('ul[aria-labelledby="read-in-browser"]')); container.push($('ul[aria-labelledby="read-in-browser"]'));
container.push($(".sendtokindle-drop")); container.push($(".sendtoereader-drop"));
container.push($(".leramslist")); container.push($(".leramslist"));
container.push($("#add-to-shelves")); container.push($("#add-to-shelves"));
container.push($(".navbar-collapse.collapse.in")); container.push($(".navbar-collapse.collapse.in"));
@ -666,7 +666,7 @@ $("#sendbtn").attr({
$("#sendbtn2").attr({ $("#sendbtn2").attr({
"data-toggle-two": "tooltip", "data-toggle-two": "tooltip",
"title": $("#sendbtn2").text(), // "Send to Kindle", "title": $("#sendbtn2").text(), // "Send to E-Reader",
"data-placement": "bottom", "data-placement": "bottom",
"data-viewport": ".btn-toolbar" "data-viewport": ".btn-toolbar"
}) })

16
cps/tasks/convert.py Normal file → Executable file
View file

@ -41,13 +41,13 @@ log = logger.create()
class TaskConvert(CalibreTask): class TaskConvert(CalibreTask):
def __init__(self, file_path, book_id, task_message, settings, kindle_mail, user=None): def __init__(self, file_path, book_id, task_message, settings, ereader_mail, user=None):
super(TaskConvert, self).__init__(task_message) super(TaskConvert, self).__init__(task_message)
self.file_path = file_path self.file_path = file_path
self.book_id = book_id self.book_id = book_id
self.title = "" self.title = ""
self.settings = settings self.settings = settings
self.kindle_mail = kindle_mail self.ereader_mail = ereader_mail
self.user = user self.user = user
self.results = dict() self.results = dict()
@ -85,16 +85,16 @@ class TaskConvert(CalibreTask):
# Upload files to gdrive # Upload files to gdrive
gdriveutils.updateGdriveCalibreFromLocal() gdriveutils.updateGdriveCalibreFromLocal()
self._handleSuccess() self._handleSuccess()
if self.kindle_mail: if self.ereader_mail:
# if we're sending to kindle after converting, create a one-off task and run it immediately # if we're sending to E-Reader after converting, create a one-off task and run it immediately
# todo: figure out how to incorporate this into the progress # todo: figure out how to incorporate this into the progress
try: try:
EmailText = N_(u"%(book)s send to Kindle", book=escape(self.title)) EmailText = N_(u"%(book)s send to E-Reader", book=escape(self.title))
worker_thread.add(self.user, TaskEmail(self.settings['subject'], worker_thread.add(self.user, TaskEmail(self.settings['subject'],
self.results["path"], self.results["path"],
filename, filename,
self.settings, self.settings,
self.kindle_mail, self.ereader_mail,
EmailText, EmailText,
self.settings['body'], self.settings['body'],
internal=True) internal=True)
@ -112,7 +112,7 @@ class TaskConvert(CalibreTask):
# check to see if destination format already exists - or if book is in database # check to see if destination format already exists - or if book is in database
# if it does - mark the conversion task as complete and return a success # if it does - mark the conversion task as complete and return a success
# this will allow send to kindle workflow to continue to work # this will allow send to E-Reader workflow to continue to work
if os.path.isfile(file_path + format_new_ext) or\ if os.path.isfile(file_path + format_new_ext) or\
local_db.get_book_format(self.book_id, self.settings['new_book_format']): local_db.get_book_format(self.book_id, self.settings['new_book_format']):
log.info("Book id %d already converted to %s", book_id, format_new_ext) log.info("Book id %d already converted to %s", book_id, format_new_ext)
@ -273,7 +273,7 @@ class TaskConvert(CalibreTask):
return N_("Convert") return N_("Convert")
def __str__(self): def __str__(self):
return "Convert {} {}".format(self.book_id, self.kindle_mail) return "Convert {} {}".format(self.book_id, self.ereader_mail)
@property @property
def is_cancellable(self): def is_cancellable(self):

2
cps/templates/admin.html Normal file → Executable file
View file

@ -12,7 +12,7 @@
<tr> <tr>
<th>{{_('Username')}}</th> <th>{{_('Username')}}</th>
<th>{{_('E-mail Address')}}</th> <th>{{_('E-mail Address')}}</th>
<th>{{_('Send to Kindle E-mail Address')}}</th> <th>{{_('Send to E-Reader E-mail Address')}}</th>
<th>{{_('Downloads')}}</th> <th>{{_('Downloads')}}</th>
<th class="hidden-xs ">{{_('Admin')}}</th> <th class="hidden-xs ">{{_('Admin')}}</th>
<th class="hidden-xs hidden-sm">{{_('Password')}}</th> <th class="hidden-xs hidden-sm">{{_('Password')}}</th>

16
cps/templates/detail.html Normal file → Executable file
View file

@ -10,7 +10,7 @@
</div> </div>
<div class="col-sm-9 col-lg-9 book-meta"> <div class="col-sm-9 col-lg-9 book-meta">
<div class="btn-toolbar" role="toolbar"> <div class="btn-toolbar" role="toolbar">
<div class="btn-group" role="group" aria-label="Download, send to Kindle, reading"> <div class="btn-group" role="group" aria-label="Download, send to E-Reader, reading">
{% if g.user.role_download() %} {% if g.user.role_download() %}
{% if entry.data|length %} {% if entry.data|length %}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
@ -37,18 +37,18 @@
</div> </div>
{% endif %} {% endif %}
{% endif %} {% endif %}
{% if g.user.kindle_mail and entry.kindle_list %} {% if g.user.kindle_mail and entry.email_share_list %}
{% if entry.kindle_list.__len__() == 1 %} {% if entry.email_share_list.__len__() == 1 %}
<div id="sendbtn" data-action="{{url_for('web.send_to_kindle', book_id=entry.id, book_format=entry.kindle_list[0]['format'], convert=entry.kindle_list[0]['convert'])}}" data-text="{{_('Send to Kindle')}}" class="btn btn-primary postAction" role="button"><span class="glyphicon glyphicon-send"></span> {{entry.kindle_list[0]['text']}}</div> <div id="sendbtn" data-action="{{url_for('web.send_to_ereader', book_id=entry.id, book_format=entry.email_share_list[0]['format'], convert=entry.email_share_list[0]['convert'])}}" data-text="{{_('Send to E-Reader')}}" class="btn btn-primary postAction" role="button"><span class="glyphicon glyphicon-send"></span> {{entry.email_share_list[0]['text']}}</div>
{% else %} {% else %}
<div class="btn-group" role="group"> <div class="btn-group" role="group">
<button id="sendbtn2" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <button id="sendbtn2" type="button" class="btn btn-primary dropdown-toggle" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<span class="glyphicon glyphicon-send"></span>{{_('Send to Kindle')}} <span class="glyphicon glyphicon-send"></span>{{_('Send to E-Reader')}}
<span class="caret"></span> <span class="caret"></span>
</button> </button>
<ul class="dropdown-menu" aria-labelledby="send-to-kindle"> <ul class="dropdown-menu" aria-labelledby="send-to-ereader">
{% for format in entry.kindle_list %} {% for format in entry.email_share_list %}
<li><a class="postAction" data-action="{{url_for('web.send_to_kindle', book_id=entry.id, book_format=format['format'], convert=format['convert'])}}">{{format['text']}}</a></li> <li><a class="postAction" data-action="{{url_for('web.send_to_ereader', book_id=entry.id, book_format=format['format'], convert=format['convert'])}}">{{format['text']}}</a></li>
{%endfor%} {%endfor%}
</ul> </ul>
</div> </div>

2
cps/templates/shelfdown.html Normal file → Executable file
View file

@ -54,7 +54,7 @@
{% endif %} {% endif %}
</div> </div>
<div class="btn-group" role="group" aria-label="Download, send to Kindle, reading"> <div class="btn-group" role="group" aria-label="Download, send to E-Reader, reading">
{% if g.user.role_download() %} {% if g.user.role_download() %}
{% if entry.Books.data|length %} {% if entry.Books.data|length %}
<div class="btn-group" role="group"> <div class="btn-group" role="group">

2
cps/templates/user_edit.html Normal file → Executable file
View file

@ -25,7 +25,7 @@
</div> </div>
{% endif %} {% endif %}
<div class="form-group"> <div class="form-group">
<label for="kindle_mail">{{_('Send to Kindle E-mail Address')}}</label> <label for="kindle_mail">{{_('Send to E-Reader E-mail Address')}}</label>
<input type="email" class="form-control" name="kindle_mail" id="kindle_mail" value="{{ content.kindle_mail if content.kindle_mail != None }}"> <input type="email" class="form-control" name="kindle_mail" id="kindle_mail" value="{{ content.kindle_mail if content.kindle_mail != None }}">
</div> </div>
{% if not content.role_anonymous() %} {% if not content.role_anonymous() %}

2
cps/templates/user_table.html Normal file → Executable file
View file

@ -133,7 +133,7 @@
<th data-name="id" data-field="id" id="id" data-visible="false" data-switchable="false"></th> <th data-name="id" data-field="id" id="id" data-visible="false" data-switchable="false"></th>
{{ user_table_row('name', _('Enter Username'), _('Username'), true) }} {{ user_table_row('name', _('Enter Username'), _('Username'), true) }}
{{ user_table_row('email', _('Enter E-mail Address'), _('E-mail Address'), true) }} {{ user_table_row('email', _('Enter E-mail Address'), _('E-mail Address'), true) }}
{{ user_table_row('kindle_mail', _('Enter Kindle E-mail Address'), _('Kindle E-mail'), false) }} {{ user_table_row('kindle_mail', _('Enter E-Reader E-mail Address'), _('E-Reader E-mail'), false) }}
{{ user_select_translations('locale', url_for('admin.table_get_locale'), _('Locale'), true) }} {{ user_select_translations('locale', url_for('admin.table_get_locale'), _('Locale'), true) }}
{{ user_select_languages('default_language', url_for('admin.table_get_default_lang'), _('Visible Book Languages'), true) }} {{ user_select_languages('default_language', url_for('admin.table_get_default_lang'), _('Visible Book Languages'), true) }}
{{ user_table_row('allowed_tags', _("Edit Allowed Tags"), _("Allowed Tags"), false, tags) }} {{ user_table_row('allowed_tags', _("Edit Allowed Tags"), _("Allowed Tags"), false, tags) }}

6
cps/web.py Normal file → Executable file
View file

@ -45,7 +45,7 @@ from .search import render_search_results, render_adv_search_results
from .gdriveutils import getFileFromEbooksFolder, do_gdrive_download from .gdriveutils import getFileFromEbooksFolder, do_gdrive_download
from .helper import check_valid_domain, check_email, check_username, \ from .helper import check_valid_domain, check_email, check_username, \
get_book_cover, get_series_cover_thumbnail, get_download_link, send_mail, generate_random_password, \ get_book_cover, get_series_cover_thumbnail, get_download_link, send_mail, generate_random_password, \
send_registration_mail, check_send_to_kindle, check_read_formats, tags_filters, reset_password, valid_email, \ send_registration_mail, check_send_to_ereader, check_read_formats, tags_filters, reset_password, valid_email, \
edit_book_read_status edit_book_read_status
from .pagination import Pagination from .pagination import Pagination
from .redirect import redirect_back from .redirect import redirect_back
@ -1189,7 +1189,7 @@ def download_link(book_id, book_format, anyname):
@web.route('/send/<int:book_id>/<book_format>/<int:convert>', methods=["POST"]) @web.route('/send/<int:book_id>/<book_format>/<int:convert>', methods=["POST"])
@login_required @login_required
@download_required @download_required
def send_to_kindle(book_id, book_format, convert): def send_to_ereader(book_id, book_format, convert):
if not config.get_mail_server_configured(): if not config.get_mail_server_configured():
flash(_(u"Please configure the SMTP mail settings first..."), category="error") flash(_(u"Please configure the SMTP mail settings first..."), category="error")
elif current_user.kindle_mail: elif current_user.kindle_mail:
@ -1521,7 +1521,7 @@ def show_book(book_id):
entry.ordered_authors = calibre_db.order_authors([entry]) entry.ordered_authors = calibre_db.order_authors([entry])
entry.kindle_list = check_send_to_kindle(entry) entry.email_share_list = check_send_to_ereader(entry)
entry.reader_list = check_read_formats(entry) entry.reader_list = check_read_formats(entry)
entry.audio_entries = [] entry.audio_entries = []

File diff suppressed because it is too large Load diff