|
|
@ -1306,41 +1306,27 @@ def read_book(book_id, book_format):
|
|
|
|
return render_title_template('readpdf.html', pdffile=book_id, title=_(u"Read a Book"))
|
|
|
|
return render_title_template('readpdf.html', pdffile=book_id, title=_(u"Read a Book"))
|
|
|
|
elif book_format.lower() == "txt":
|
|
|
|
elif book_format.lower() == "txt":
|
|
|
|
return render_title_template('readtxt.html', txtfile=book_id, title=_(u"Read a Book"))
|
|
|
|
return render_title_template('readtxt.html', txtfile=book_id, title=_(u"Read a Book"))
|
|
|
|
elif book_format.lower() == "mp3":
|
|
|
|
else:
|
|
|
|
entries = db.session.query(db.Books).filter(db.Books.id == book_id).filter(common_filters()).first()
|
|
|
|
for fileExt in ["mp3", "m4b", "m4a"]:
|
|
|
|
return render_title_template('listenmp3.html', mp3file=book_id, audioformat=book_format.lower(),
|
|
|
|
if book_format.lower() == fileExt:
|
|
|
|
title=_(u"Read a Book"), entry=entries, bookmark=bookmark)
|
|
|
|
|
|
|
|
elif book_format.lower() == "m4b":
|
|
|
|
|
|
|
|
entries = db.session.query(db.Books).filter(db.Books.id == book_id).filter(common_filters()).first()
|
|
|
|
|
|
|
|
return render_title_template('listenmp3.html', mp3file=book_id, audioformat=book_format.lower(),
|
|
|
|
|
|
|
|
title=_(u"Read a Book"), entry=entries, bookmark=bookmark)
|
|
|
|
|
|
|
|
elif book_format.lower() == "m4a":
|
|
|
|
|
|
|
|
entries = db.session.query(db.Books).filter(db.Books.id == book_id).filter(common_filters()).first()
|
|
|
|
entries = db.session.query(db.Books).filter(db.Books.id == book_id).filter(common_filters()).first()
|
|
|
|
return render_title_template('listenmp3.html', mp3file=book_id, audioformat=book_format.lower(),
|
|
|
|
return render_title_template('listenmp3.html', mp3file=book_id, audioformat=book_format.lower(),
|
|
|
|
title=_(u"Read a Book"), entry=entries, bookmark=bookmark)
|
|
|
|
title=_(u"Read a Book"), entry=entries, bookmark=bookmark)
|
|
|
|
else:
|
|
|
|
for fileExt in ["cbr", "cbt", "cbz"]:
|
|
|
|
book_dir = os.path.join(config.get_main_dir, "cps", "static", str(book_id))
|
|
|
|
if book_format.lower() == fileExt:
|
|
|
|
if not os.path.exists(book_dir):
|
|
|
|
all_name = str(book_id)
|
|
|
|
os.mkdir(book_dir)
|
|
|
|
|
|
|
|
for fileext in ["cbr", "cbt", "cbz"]:
|
|
|
|
|
|
|
|
if book_format.lower() == fileext:
|
|
|
|
|
|
|
|
all_name = str(book_id) # + "/" + book.data[0].name + "." + fileext
|
|
|
|
|
|
|
|
# tmp_file = os.path.join(book_dir, book.data[0].name) + "." + fileext
|
|
|
|
|
|
|
|
# if not os.path.exists(all_name):
|
|
|
|
|
|
|
|
# cbr_file = os.path.join(config.config_calibre_dir, book.path, book.data[0].name) + "." + fileext
|
|
|
|
|
|
|
|
# copyfile(cbr_file, tmp_file)
|
|
|
|
|
|
|
|
return render_title_template('readcbr.html', comicfile=all_name, title=_(u"Read a Book"),
|
|
|
|
return render_title_template('readcbr.html', comicfile=all_name, title=_(u"Read a Book"),
|
|
|
|
extension=fileext)
|
|
|
|
extension=fileExt)
|
|
|
|
'''if feature_support['rar']:
|
|
|
|
# if feature_support['rar']:
|
|
|
|
extensionList = ["cbr","cbt","cbz"]
|
|
|
|
# extensionList = ["cbr","cbt","cbz"]
|
|
|
|
else:
|
|
|
|
# else:
|
|
|
|
extensionList = ["cbt","cbz"]
|
|
|
|
# extensionList = ["cbt","cbz"]
|
|
|
|
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,
|
|
|
|
# return render_title_template('readcbr.html', comicfile=book_id,
|
|
|
|
extension=fileext, title=_(u"Read a Book"), book=book)
|
|
|
|
# extension=fileext, title=_(u"Read a Book"), book=book)
|
|
|
|
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("web.index"))'''
|
|
|
|
return redirect(url_for("web.index"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@web.route("/book/<int:book_id>")
|
|
|
|
@web.route("/book/<int:book_id>")
|
|
|
|