|
|
|
@ -33,7 +33,7 @@ import sys
|
|
|
|
|
from werkzeug.utils import secure_filename
|
|
|
|
|
|
|
|
|
|
# import sqlite3
|
|
|
|
|
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'epub', 'chm', 'mobi'])
|
|
|
|
|
ALLOWED_EXTENSIONS = set(['txt', 'pdf', 'epub', 'chm', 'mobi', "png", "mp3"])
|
|
|
|
|
|
|
|
|
|
author_schema = AuthorSchema()
|
|
|
|
|
authors_schema = AuthorSchema(many=True)
|
|
|
|
@ -123,17 +123,6 @@ def annotations_pdf():
|
|
|
|
|
html = render_template(('annotations.html'), annot=annot, light=light)
|
|
|
|
|
return render_pdf(HTML(string=html))
|
|
|
|
|
|
|
|
|
|
# @app.route('/myannotations.pdf')
|
|
|
|
|
# def myannotations_pdf():
|
|
|
|
|
# books = db.session.query(Book).all()
|
|
|
|
|
# name=str(request.args.get('query'))
|
|
|
|
|
# annot = get_annotations()
|
|
|
|
|
# res = get_annot_results(annot,name)
|
|
|
|
|
# # Make a PDF straight from HTML in a string.
|
|
|
|
|
# html = render_template('results_annot.html', name=name, annot=annot, res=res, books=books)
|
|
|
|
|
# return render_pdf(HTML(string=html))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@app.route('/viewpdf/<filename>')
|
|
|
|
|
def viewtestfile1_file(filename):
|
|
|
|
|
return redirect("/static/viewer/web/viewer.html?file=%2Fuploads%2F"+urlquote(filename))
|
|
|
|
@ -446,6 +435,8 @@ def edit_author_by_id(id):
|
|
|
|
|
@app.route('/stacks')
|
|
|
|
|
def show_stacks():
|
|
|
|
|
stacks = db.session.query(Stack).all()
|
|
|
|
|
print("stacks looooooook")
|
|
|
|
|
print(stacks)
|
|
|
|
|
return render_template('show_stacks.html', stacks=stacks, light=light)
|
|
|
|
|
|
|
|
|
|
@app.route('/stacks/add_stack', methods=['POST', 'GET'])
|
|
|
|
@ -462,6 +453,7 @@ def add_stack():
|
|
|
|
|
if form.stack_name.data:
|
|
|
|
|
stack = Stack(stack_name, stack_description, stack_author)
|
|
|
|
|
db.session.add(stack)
|
|
|
|
|
db.session.commit()
|
|
|
|
|
stacks = db.session.query(Stack).all()
|
|
|
|
|
return redirect(url_for('show_stacks'))
|
|
|
|
|
flash("%s stack created" % (stack_name))
|
|
|
|
@ -561,15 +553,15 @@ def show_books():
|
|
|
|
|
view.append('1')
|
|
|
|
|
viewby = '1'
|
|
|
|
|
|
|
|
|
|
if search.grid.data:
|
|
|
|
|
viewby = '2'
|
|
|
|
|
view.append('2')
|
|
|
|
|
return render_template ('show_books_grid.html', books=books, form=search, light=light)
|
|
|
|
|
# if search.grid.data:
|
|
|
|
|
# viewby = '2'
|
|
|
|
|
# view.append('2')
|
|
|
|
|
# return render_template ('show_books_grid.html', books=books, form=search, light=light)
|
|
|
|
|
|
|
|
|
|
if search.listview.data:
|
|
|
|
|
viewby = '1'
|
|
|
|
|
view.append('1')
|
|
|
|
|
return render_template ('show_books.html', books=books, form=search, light=light)
|
|
|
|
|
# if search.listview.data:
|
|
|
|
|
# viewby = '1'
|
|
|
|
|
# view.append('1')
|
|
|
|
|
# return render_template ('show_books.html', books=books, form=search, light=light)
|
|
|
|
|
|
|
|
|
|
if request.method == 'POST':
|
|
|
|
|
newmsg = 'searched for: ' + search.search.data
|
|
|
|
|