|
|
@ -473,7 +473,9 @@ def feed_search(term):
|
|
|
|
filter = True
|
|
|
|
filter = True
|
|
|
|
if term:
|
|
|
|
if term:
|
|
|
|
entries = db.session.query(db.Books).filter(db.or_(db.Books.tags.any(db.Tags.name.like("%" + term + "%")),
|
|
|
|
entries = db.session.query(db.Books).filter(db.or_(db.Books.tags.any(db.Tags.name.like("%" + term + "%")),
|
|
|
|
|
|
|
|
db.Books.series.any(db.Series.name.like("%" + term + "%")),
|
|
|
|
db.Books.authors.any(db.Authors.name.like("%" + term + "%")),
|
|
|
|
db.Books.authors.any(db.Authors.name.like("%" + term + "%")),
|
|
|
|
|
|
|
|
db.Books.publishers.any(db.Publishers.name.like("%" + term + "%")),
|
|
|
|
db.Books.title.like("%" + term + "%"))).filter(filter).all()
|
|
|
|
db.Books.title.like("%" + term + "%"))).filter(filter).all()
|
|
|
|
entriescount = len(entries) if len(entries) > 0 else 1
|
|
|
|
entriescount = len(entries) if len(entries) > 0 else 1
|
|
|
|
pagination = Pagination(1, entriescount, entriescount)
|
|
|
|
pagination = Pagination(1, entriescount, entriescount)
|
|
|
@ -744,7 +746,10 @@ def get_updater_status():
|
|
|
|
helper.updater_thread.start()
|
|
|
|
helper.updater_thread.start()
|
|
|
|
status['status']=helper.updater_thread.get_update_status()
|
|
|
|
status['status']=helper.updater_thread.get_update_status()
|
|
|
|
elif request.method == "GET":
|
|
|
|
elif request.method == "GET":
|
|
|
|
|
|
|
|
try:
|
|
|
|
status['status']=helper.updater_thread.get_update_status()
|
|
|
|
status['status']=helper.updater_thread.get_update_status()
|
|
|
|
|
|
|
|
except:
|
|
|
|
|
|
|
|
status['status'] = 7
|
|
|
|
return json.dumps(status)
|
|
|
|
return json.dumps(status)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1044,9 +1049,9 @@ def stats():
|
|
|
|
@login_required
|
|
|
|
@login_required
|
|
|
|
@admin_required
|
|
|
|
@admin_required
|
|
|
|
def shutdown():
|
|
|
|
def shutdown():
|
|
|
|
global global_task
|
|
|
|
# global global_task
|
|
|
|
task = int(request.args.get("parameter").strip())
|
|
|
|
task = int(request.args.get("parameter").strip())
|
|
|
|
global_task = task
|
|
|
|
helper.global_task = task
|
|
|
|
if task == 1 or task == 0: # valid commandos received
|
|
|
|
if task == 1 or task == 0: # valid commandos received
|
|
|
|
# close all database connections
|
|
|
|
# close all database connections
|
|
|
|
db.session.close()
|
|
|
|
db.session.close()
|
|
|
@ -1086,6 +1091,7 @@ def search():
|
|
|
|
entries = db.session.query(db.Books).filter(db.or_(db.Books.tags.any(db.Tags.name.like("%" + term + "%")),
|
|
|
|
entries = db.session.query(db.Books).filter(db.or_(db.Books.tags.any(db.Tags.name.like("%" + term + "%")),
|
|
|
|
db.Books.series.any(db.Series.name.like("%" + term + "%")),
|
|
|
|
db.Books.series.any(db.Series.name.like("%" + term + "%")),
|
|
|
|
db.Books.authors.any(db.Authors.name.like("%" + term + "%")),
|
|
|
|
db.Books.authors.any(db.Authors.name.like("%" + term + "%")),
|
|
|
|
|
|
|
|
db.Books.publishers.any(db.Publishers.name.like("%" + term + "%")),
|
|
|
|
db.Books.title.like("%" + term + "%"))).filter(filter).all()
|
|
|
|
db.Books.title.like("%" + term + "%"))).filter(filter).all()
|
|
|
|
return render_title_template('search.html', searchterm=term, entries=entries)
|
|
|
|
return render_title_template('search.html', searchterm=term, entries=entries)
|
|
|
|
else:
|
|
|
|
else:
|
|
|
@ -1106,12 +1112,14 @@ def advanced_search():
|
|
|
|
|
|
|
|
|
|
|
|
author_name = request.args.get("author_name")
|
|
|
|
author_name = request.args.get("author_name")
|
|
|
|
book_title = request.args.get("book_title")
|
|
|
|
book_title = request.args.get("book_title")
|
|
|
|
|
|
|
|
publisher = request.args.get("publisher")
|
|
|
|
if author_name: author_name = author_name.strip()
|
|
|
|
if author_name: author_name = author_name.strip()
|
|
|
|
if book_title: book_title = book_title.strip()
|
|
|
|
if book_title: book_title = book_title.strip()
|
|
|
|
|
|
|
|
if publisher: publisher = publisher.strip()
|
|
|
|
if include_tag_inputs or exclude_tag_inputs or include_series_inputs or exclude_series_inputs or \
|
|
|
|
if include_tag_inputs or exclude_tag_inputs or include_series_inputs or exclude_series_inputs or \
|
|
|
|
include_languages_inputs or exclude_languages_inputs or author_name or book_title:
|
|
|
|
include_languages_inputs or exclude_languages_inputs or author_name or book_title or publisher:
|
|
|
|
searchterm = []
|
|
|
|
searchterm = []
|
|
|
|
searchterm.extend((author_name, book_title))
|
|
|
|
searchterm.extend((author_name, book_title, publisher))
|
|
|
|
tag_names = db.session.query(db.Tags).filter(db.Tags.id.in_(include_tag_inputs)).all()
|
|
|
|
tag_names = db.session.query(db.Tags).filter(db.Tags.id.in_(include_tag_inputs)).all()
|
|
|
|
searchterm.extend(tag.name for tag in tag_names)
|
|
|
|
searchterm.extend(tag.name for tag in tag_names)
|
|
|
|
# searchterm = " + ".join(filter(None, searchterm))
|
|
|
|
# searchterm = " + ".join(filter(None, searchterm))
|
|
|
@ -1127,7 +1135,8 @@ def advanced_search():
|
|
|
|
searchterm.extend(language.name for language in language_names)
|
|
|
|
searchterm.extend(language.name for language in language_names)
|
|
|
|
searchterm = " + ".join(filter(None, searchterm))
|
|
|
|
searchterm = " + ".join(filter(None, searchterm))
|
|
|
|
q = q.filter(db.Books.authors.any(db.Authors.name.like("%" + author_name + "%")),
|
|
|
|
q = q.filter(db.Books.authors.any(db.Authors.name.like("%" + author_name + "%")),
|
|
|
|
db.Books.title.like("%" + book_title + "%"))
|
|
|
|
db.Books.title.like("%" + book_title + "%"),
|
|
|
|
|
|
|
|
db.Books.publishers.any(db.Publishers.name.like("%" + publisher + "%")))
|
|
|
|
for tag in include_tag_inputs:
|
|
|
|
for tag in include_tag_inputs:
|
|
|
|
q = q.filter(db.Books.tags.any(db.Tags.id == tag))
|
|
|
|
q = q.filter(db.Books.tags.any(db.Tags.id == tag))
|
|
|
|
for tag in exclude_tag_inputs:
|
|
|
|
for tag in exclude_tag_inputs:
|
|
|
@ -1611,7 +1620,7 @@ def basic_configuration():
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def configuration_helper(origin):
|
|
|
|
def configuration_helper(origin):
|
|
|
|
global global_task
|
|
|
|
# global global_task
|
|
|
|
reboot_required = False
|
|
|
|
reboot_required = False
|
|
|
|
db_change = False
|
|
|
|
db_change = False
|
|
|
|
success = False
|
|
|
|
success = False
|
|
|
@ -1686,7 +1695,7 @@ def configuration_helper(origin):
|
|
|
|
# stop tornado server
|
|
|
|
# stop tornado server
|
|
|
|
server = IOLoop.instance()
|
|
|
|
server = IOLoop.instance()
|
|
|
|
server.add_callback(server.stop)
|
|
|
|
server.add_callback(server.stop)
|
|
|
|
global_task = 0
|
|
|
|
helper.global_task = 0
|
|
|
|
app.logger.info('Reboot required, restarting')
|
|
|
|
app.logger.info('Reboot required, restarting')
|
|
|
|
if origin:
|
|
|
|
if origin:
|
|
|
|
success = True
|
|
|
|
success = True
|
|
|
|