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