Merge branch 'develop' into thumbnails

This commit is contained in:
mmonkey
2022-01-28 23:15:50 -06:00
6 changed files with 58 additions and 56 deletions
+2 -1
View File
@@ -810,7 +810,8 @@ def edit_book(book_id):
if "cover_url" in to_save:
if to_save["cover_url"]:
if not current_user.role_upload():
return "", (403)
calibre_db.session.rollback()
return "", 403
if to_save["cover_url"].endswith('/static/generic_cover.jpg'):
book.has_cover = 0
else:
+3 -2
View File
@@ -437,7 +437,7 @@ def update_dir_structure_file(book_id, calibrepath, first_author, orignal_filepa
# Rename all files from old names to new names
try:
clean_author_database(renamed_author, calibrepath)
if first_author not in renamed_author:
if first_author and first_author not in renamed_author:
clean_author_database([first_author], calibrepath, localbook)
if not renamed_author and not orignal_filepath and len(os.listdir(os.path.dirname(path))) == 0:
shutil.rmtree(os.path.dirname(path))
@@ -585,7 +585,8 @@ def update_dir_structure(book_id,
first_author=None,
orignal_filepath=None,
db_filename=None,
renamed_author=False):
renamed_author=None):
renamed_author = renamed_author or []
if config.config_use_google_drive:
return update_dir_structure_gdrive(book_id, first_author, renamed_author)
else:
+1 -1
View File
@@ -39,7 +39,7 @@
{% endif %}
{% if g.user.kindle_mail and entry.kindle_list %}
{% if entry.kindle_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" role="button"><span class="glyphicon glyphicon-send"></span> {{entry.kindle_list[0]['text']}}</div>
<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>
{% else %}
<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">
+16 -16
View File
@@ -40,35 +40,35 @@
{% if entries and entries[0] %}
{% for entry in entries %}
<entry>
<title>{{entry.title}}</title>
<id>urn:uuid:{{entry.uuid}}</id>
<updated>{{entry.atom_timestamp}}</updated>
{% if entry.authors.__len__() > 0 %}
<title>{{entry[0].title}}</title>
<id>urn:uuid:{{entry[0].uuid}}</id>
<updated>{{entry[0].atom_timestamp}}</updated>
{% if entry[0].authors.__len__() > 0 %}
<author>
<name>{{entry.authors[0].name}}</name>
<name>{{entry[0].authors[0].name}}</name>
</author>
{% endif %}
{% if entry.publishers.__len__() > 0 %}
{% if entry[0].publishers.__len__() > 0 %}
<publisher>
<name>{{entry.publishers[0].name}}</name>
<name>{{entry[0].publishers[0].name}}</name>
</publisher>
{% endif %}
{% for lang in entry.languages %}
{% for lang in entry[0].languages %}
<dcterms:language>{{lang.lang_code}}</dcterms:language>
{% endfor %}
{% for tag in entry.tags %}
{% for tag in entry[0].tags %}
<category scheme="http://www.bisg.org/standards/bisac_subject/index.html"
term="{{tag.name}}"
label="{{tag.name}}"/>
{% endfor %}
{% if entry.comments[0] %}<summary>{{entry.comments[0].text|striptags}}</summary>{% endif %}
{% if entry.has_cover %}
<link type="image/jpeg" href="{{url_for('opds.feed_get_cover', book_id=entry.id)}}" rel="http://opds-spec.org/image"/>
<link type="image/jpeg" href="{{url_for('opds.feed_get_cover', book_id=entry.id)}}" rel="http://opds-spec.org/image/thumbnail"/>
{% if entry[0].comments[0] %}<summary>{{entry[0].comments[0].text|striptags}}</summary>{% endif %}
{% if entry[0].has_cover %}
<link type="image/jpeg" href="{{url_for('opds.feed_get_cover', book_id=entry[0].id)}}" rel="http://opds-spec.org/image"/>
<link type="image/jpeg" href="{{url_for('opds.feed_get_cover', book_id=entry[0].id)}}" rel="http://opds-spec.org/image/thumbnail"/>
{% endif %}
{% for format in entry.data %}
<link rel="http://opds-spec.org/acquisition" href="{{ url_for('opds.opds_download_link', book_id=entry.id, book_format=format.format|lower)}}"
length="{{format.uncompressed_size}}" mtime="{{entry.atom_timestamp}}" type="{{format.format|lower|mimetype}}"/>
{% for format in entry[0].data %}
<link rel="http://opds-spec.org/acquisition" href="{{ url_for('opds.opds_download_link', book_id=entry[0].id, book_format=format.format|lower)}}"
length="{{format.uncompressed_size}}" mtime="{{entry[0].atom_timestamp}}" type="{{format.format|lower|mimetype}}"/>
{% endfor %}
</entry>
{% endfor %}
+1 -1
View File
@@ -91,7 +91,7 @@ def delete_user_session(user_id, session_key):
session.query(User_Sessions).filter(User_Sessions.user_id==user_id,
User_Sessions.session_key==session_key).delete()
session.commit()
except (exc.OperationalError, exc.InvalidRequestError):
except (exc.OperationalError, exc.InvalidRequestError) as e:
session.rollback()
log.exception(e)