mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-24 18:47:23 +00:00
Small improvements for comic reader calls
This commit is contained in:
parent
5756785073
commit
e7b6963afd
13
cps/web.py
13
cps/web.py
@ -920,7 +920,7 @@ def get_metadata_calibre_companion(uuid):
|
|||||||
def get_comic_book(book_id, book_format, page):
|
def get_comic_book(book_id, book_format, page):
|
||||||
book = db.session.query(db.Books).filter(db.Books.id == book_id).first()
|
book = db.session.query(db.Books).filter(db.Books.id == book_id).first()
|
||||||
if not book:
|
if not book:
|
||||||
return ""
|
return "", 204
|
||||||
else:
|
else:
|
||||||
for bookformat in book.data:
|
for bookformat in book.data:
|
||||||
if bookformat.format.lower() == book_format.lower():
|
if bookformat.format.lower() == book_format.lower():
|
||||||
@ -935,12 +935,12 @@ def get_comic_book(book_id, book_format, page):
|
|||||||
fileData={"name": rarNames[page],"page":page, "last":rarNames.__len__()-1, "content": extractedfile}
|
fileData={"name": rarNames[page],"page":page, "last":rarNames.__len__()-1, "content": extractedfile}
|
||||||
except:
|
except:
|
||||||
# rarfile not valid
|
# rarfile not valid
|
||||||
app.logger.error('Unrar binary not found unable to decompress file ' + cbr_file)
|
app.logger.error('Unrar binary not found, or unable to decompress file ' + cbr_file)
|
||||||
return ""
|
return "", 204
|
||||||
else:
|
else:
|
||||||
app.logger.info('Unrar is not supported please install python rarfile extension')
|
app.logger.info('Unrar is not supported please install python rarfile extension')
|
||||||
# no support means return nothing
|
# no support means return nothing
|
||||||
return ""
|
return "", 204
|
||||||
if book_format == "cbz":
|
if book_format == "cbz":
|
||||||
zf = zipfile.ZipFile(cbr_file)
|
zf = zipfile.ZipFile(cbr_file)
|
||||||
zipNames=zf.namelist()
|
zipNames=zf.namelist()
|
||||||
@ -1961,9 +1961,8 @@ def read_book(book_id, book_format):
|
|||||||
for fileext in extensionList:
|
for fileext in extensionList:
|
||||||
if book_format.lower() == fileext:
|
if book_format.lower() == fileext:
|
||||||
return render_title_template('readcbr.html', comicfile=book_id, extension=fileext, title=_(u"Read a Book"))
|
return render_title_template('readcbr.html', comicfile=book_id, extension=fileext, title=_(u"Read a Book"))
|
||||||
else:
|
flash(_(u"Error opening eBook. File does not exist or file is not accessible."), category="error")
|
||||||
flash(_(u"Error opening eBook. File does not exist or file is not accessible:"), category="error")
|
return redirect(url_for("index"))
|
||||||
|
|
||||||
|
|
||||||
@app.route("/download/<int:book_id>/<book_format>")
|
@app.route("/download/<int:book_id>/<book_format>")
|
||||||
@login_required_if_no_ano
|
@login_required_if_no_ano
|
||||||
|
Loading…
Reference in New Issue
Block a user