Allow download of archived books

This commit is contained in:
Ozzie Isaacs 2021-12-04 11:16:33 +01:00
parent f4096b136e
commit 91a21ababe
3 changed files with 12 additions and 14 deletions

View file

@ -823,7 +823,7 @@ def get_cc_columns(filter_config_custom_read=False):
def get_download_link(book_id, book_format, client):
book_format = book_format.split(".")[0]
book = calibre_db.get_filtered_book(book_id)
book = calibre_db.get_filtered_book(book_id, allow_show_archived=True)
if book:
data1 = calibre_db.get_book_format(book.id, book_format.upper())
else:

View file

@ -355,7 +355,9 @@ def HandleMetadataRequest(book_uuid):
return redirect_or_proxy_request()
metadata = get_metadata(book)
return jsonify([metadata])
response = make_response(json.dumps([metadata]))
response.headers["Content-Type"] = "application/json; charset=utf-8"
return response
def get_download_url_for_book(book, book_format):
@ -413,15 +415,12 @@ def get_description(book):
def get_author(book):
if not book.authors:
return {"Contributors": None}
if len(book.authors) > 1:
author_list = []
autor_roles = []
for author in book.authors:
autor_roles.append({"Name":author.name}) #.encode('unicode-escape').decode('latin-1')
author_list.append(author.name)
return {"ContributorRoles": autor_roles, "Contributors":author_list}
return {"ContributorRoles": [{"Name":book.authors[0].name}],
"Contributors": book.authors[0].name}
def get_publisher(book):

View file

@ -182,10 +182,9 @@ class SyncToken:
return b64encode_json(token)
def __str__(self):
return "{},{},{},{},{},{}".format(self.raw_kobo_store_token,
self.books_last_created,
return "{},{},{},{},{},{}".format(self.books_last_created,
self.books_last_modified,
self.archive_last_modified,
self.reading_state_last_modified,
self.tags_last_modified)
self.tags_last_modified, self.raw_kobo_store_token)
#self.books_last_id)