Basi comic reader implementation for cbr, cbz, cbt files based on kthoom (#63, #126)

This commit is contained in:
OzzieIsaacs
2017-09-17 12:36:32 +02:00
10 changed files with 3299 additions and 10 deletions

View File

@ -1807,13 +1807,15 @@ def read_book(book_id, book_format):
return render_title_template('readpdf.html', pdffile=book_id, title=_(u"Read a Book"))
elif book_format.lower() == "txt":
return render_title_template('readtxt.html', txtfile=book_id, title=_(u"Read a Book"))
elif book_format.lower() == "cbr":
all_name = str(book_id) + "/" + book.data[0].name + ".cbr"
tmp_file = os.path.join(book_dir, book.data[0].name) + ".cbr"
if not os.path.exists(all_name):
cbr_file = os.path.join(config.config_calibre_dir, book.path, book.data[0].name) + ".cbr"
copyfile(cbr_file, tmp_file)
return render_title_template('readcbr.html', comicfile=all_name, title=_(u"Read a Book"))
else:
for format in ["cbr","cbt","cbz"]:
if book_format.lower() == format:
all_name = str(book_id) + "/" + book.data[0].name + "." + format
tmp_file = os.path.join(book_dir, book.data[0].name) + "." + format
if not os.path.exists(all_name):
cbr_file = os.path.join(config.config_calibre_dir, book.path, book.data[0].name) + "." + format
copyfile(cbr_file, tmp_file)
return render_title_template('readcbr.html', comicfile=all_name, title=_(u"Read a Book"))
@app.route("/download/<int:book_id>/<book_format>")