mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-28 12:30:00 +00:00
Merge branch 'janeczku-master'
This commit is contained in:
commit
2853ed1477
4
cps.py
4
cps.py
@ -22,8 +22,8 @@ if __name__ == '__main__':
|
|||||||
IOLoop.instance().start()
|
IOLoop.instance().start()
|
||||||
|
|
||||||
if web.helper.global_task == 0:
|
if web.helper.global_task == 0:
|
||||||
print("Performing restart of Calibre-web")
|
web.app.logger.info("Performing restart of Calibre-web")
|
||||||
os.execl(sys.executable, sys.executable, *sys.argv)
|
os.execl(sys.executable, sys.executable, *sys.argv)
|
||||||
else:
|
else:
|
||||||
print("Performing shutdown of Calibre-web")
|
web.app.logger.info("Performing shutdown of Calibre-web")
|
||||||
sys.exit(0)
|
sys.exit(0)
|
||||||
|
20
cps/db.py
20
cps/db.py
@ -56,6 +56,10 @@ books_languages_link = Table('books_languages_link', Base.metadata,
|
|||||||
Column('lang_code', Integer, ForeignKey('languages.id'), primary_key=True)
|
Column('lang_code', Integer, ForeignKey('languages.id'), primary_key=True)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
books_publishers_link = Table('books_publishers_link', Base.metadata,
|
||||||
|
Column('book', Integer, ForeignKey('books.id'), primary_key=True),
|
||||||
|
Column('publisher', Integer, ForeignKey('publishers.id'), primary_key=True)
|
||||||
|
)
|
||||||
|
|
||||||
class Identifiers(Base):
|
class Identifiers(Base):
|
||||||
__tablename__ = 'identifiers'
|
__tablename__ = 'identifiers'
|
||||||
@ -182,6 +186,21 @@ class Languages(Base):
|
|||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return u"<Languages('{0}')>".format(self.lang_code)
|
return u"<Languages('{0}')>".format(self.lang_code)
|
||||||
|
|
||||||
|
class Publishers(Base):
|
||||||
|
__tablename__ = 'publishers'
|
||||||
|
|
||||||
|
id = Column(Integer, primary_key=True)
|
||||||
|
name = Column(String)
|
||||||
|
sort = Column(String)
|
||||||
|
|
||||||
|
def __init__(self, name,sort):
|
||||||
|
self.name = name
|
||||||
|
self.sort = sort
|
||||||
|
|
||||||
|
def __repr__(self):
|
||||||
|
return u"<Publishers('{0},{1}')>".format(self.name, self.sort)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
class Data(Base):
|
class Data(Base):
|
||||||
__tablename__ = 'data'
|
__tablename__ = 'data'
|
||||||
@ -224,6 +243,7 @@ class Books(Base):
|
|||||||
series = relationship('Series', secondary=books_series_link, backref='books')
|
series = relationship('Series', secondary=books_series_link, backref='books')
|
||||||
ratings = relationship('Ratings', secondary=books_ratings_link, backref='books')
|
ratings = relationship('Ratings', secondary=books_ratings_link, backref='books')
|
||||||
languages = relationship('Languages', secondary=books_languages_link, backref='books')
|
languages = relationship('Languages', secondary=books_languages_link, backref='books')
|
||||||
|
publishers = relationship('Publishers', secondary=books_publishers_link, backref='books')
|
||||||
identifiers = relationship('Identifiers', backref='books')
|
identifiers = relationship('Identifiers', backref='books')
|
||||||
|
|
||||||
def __init__(self, title, sort, author_sort, timestamp, pubdate, series_index, last_modified, path, has_cover,
|
def __init__(self, title, sort, author_sort, timestamp, pubdate, series_index, last_modified, path, has_cover,
|
||||||
|
@ -338,7 +338,7 @@ class Updater(threading.Thread):
|
|||||||
def reduce_files(self, remove_items, exclude_items):
|
def reduce_files(self, remove_items, exclude_items):
|
||||||
rf = []
|
rf = []
|
||||||
for item in remove_items:
|
for item in remove_items:
|
||||||
if not item in exclude_items:
|
if not item.startswith(exclude_items):
|
||||||
rf.append(item)
|
rf.append(item)
|
||||||
return rf
|
return rf
|
||||||
|
|
||||||
@ -347,15 +347,14 @@ class Updater(threading.Thread):
|
|||||||
if sys.platform == "win32" or sys.platform == "darwin":
|
if sys.platform == "win32" or sys.platform == "darwin":
|
||||||
change_permissions = False
|
change_permissions = False
|
||||||
else:
|
else:
|
||||||
app.logger.debug('Update on OS-System : ' + sys.platform)
|
logging.getLogger('cps.web').debug('Update on OS-System : ' + sys.platform)
|
||||||
# print('OS-System: '+sys.platform )
|
|
||||||
new_permissions = os.stat(root_dst_dir)
|
new_permissions = os.stat(root_dst_dir)
|
||||||
# print new_permissions
|
# print new_permissions
|
||||||
for src_dir, dirs, files in os.walk(root_src_dir):
|
for src_dir, dirs, files in os.walk(root_src_dir):
|
||||||
dst_dir = src_dir.replace(root_src_dir, root_dst_dir, 1)
|
dst_dir = src_dir.replace(root_src_dir, root_dst_dir, 1)
|
||||||
if not os.path.exists(dst_dir):
|
if not os.path.exists(dst_dir):
|
||||||
os.makedirs(dst_dir)
|
os.makedirs(dst_dir)
|
||||||
# print('Create-Dir: '+dst_dir)
|
logging.getLogger('cps.web').debug('Create-Dir: '+dst_dir)
|
||||||
if change_permissions:
|
if change_permissions:
|
||||||
# print('Permissions: User '+str(new_permissions.st_uid)+' Group '+str(new_permissions.st_uid))
|
# print('Permissions: User '+str(new_permissions.st_uid)+' Group '+str(new_permissions.st_uid))
|
||||||
os.chown(dst_dir, new_permissions.st_uid, new_permissions.st_gid)
|
os.chown(dst_dir, new_permissions.st_uid, new_permissions.st_gid)
|
||||||
@ -365,27 +364,28 @@ class Updater(threading.Thread):
|
|||||||
if os.path.exists(dst_file):
|
if os.path.exists(dst_file):
|
||||||
if change_permissions:
|
if change_permissions:
|
||||||
permission = os.stat(dst_file)
|
permission = os.stat(dst_file)
|
||||||
# print('Remove file before copy: '+dst_file)
|
logging.getLogger('cps.web').debug('Remove file before copy: '+dst_file)
|
||||||
os.remove(dst_file)
|
os.remove(dst_file)
|
||||||
else:
|
else:
|
||||||
if change_permissions:
|
if change_permissions:
|
||||||
permission = new_permissions
|
permission = new_permissions
|
||||||
shutil.move(src_file, dst_dir)
|
shutil.move(src_file, dst_dir)
|
||||||
# print('Move File '+src_file+' to '+dst_dir)
|
logging.getLogger('cps.web').debug('Move File '+src_file+' to '+dst_dir)
|
||||||
if change_permissions:
|
if change_permissions:
|
||||||
try:
|
try:
|
||||||
os.chown(dst_file, permission.st_uid, permission.st_uid)
|
os.chown(dst_file, permission.st_uid, permission.st_uid)
|
||||||
# print('Permissions: User '+str(new_permissions.st_uid)+' Group '+str(new_permissions.st_uid))
|
# print('Permissions: User '+str(new_permissions.st_uid)+' Group '+str(new_permissions.st_uid))
|
||||||
except:
|
except:
|
||||||
e = sys.exc_info()
|
e = sys.exc_info()
|
||||||
# print('Fail '+str(dst_file)+' error: '+str(e))
|
logging.getLogger('cps.web').debug('Fail '+str(dst_file)+' error: '+str(e))
|
||||||
return
|
return
|
||||||
|
|
||||||
def update_source(self, source, destination):
|
def update_source(self, source, destination):
|
||||||
# destination files
|
# destination files
|
||||||
old_list = list()
|
old_list = list()
|
||||||
exclude = (
|
exclude = (
|
||||||
['vendor' + os.sep + 'kindlegen.exe', 'vendor' + os.sep + 'kindlegen', '/app.db', 'vendor', '/update.py'])
|
'vendor' + os.sep + 'kindlegen.exe', 'vendor' + os.sep + 'kindlegen', os.sep + 'app.db',
|
||||||
|
os.sep + 'vendor',os.sep + 'calibre-web.log')
|
||||||
for root, dirs, files in os.walk(destination, topdown=True):
|
for root, dirs, files in os.walk(destination, topdown=True):
|
||||||
for name in files:
|
for name in files:
|
||||||
old_list.append(os.path.join(root, name).replace(destination, ''))
|
old_list.append(os.path.join(root, name).replace(destination, ''))
|
||||||
@ -410,12 +410,14 @@ class Updater(threading.Thread):
|
|||||||
for item in remove_items:
|
for item in remove_items:
|
||||||
item_path = os.path.join(destination, item[1:])
|
item_path = os.path.join(destination, item[1:])
|
||||||
if os.path.isdir(item_path):
|
if os.path.isdir(item_path):
|
||||||
app.logger.debug("Delete dir " + item_path)
|
logging.getLogger('cps.web').debug("Delete dir " + item_path)
|
||||||
shutil.rmtree(item_path)
|
shutil.rmtree(item_path)
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
app.logger.debug("Delete file " + item_path)
|
logging.getLogger('cps.web').debug("Delete file " + item_path)
|
||||||
|
log_from_thread("Delete file " + item_path)
|
||||||
os.remove(item_path)
|
os.remove(item_path)
|
||||||
except:
|
except:
|
||||||
app.logger.debug("Could not remove:" + item_path)
|
logging.getLogger('cps.web').debug("Could not remove:" + item_path)
|
||||||
shutil.rmtree(source, ignore_errors=True)
|
shutil.rmtree(source, ignore_errors=True)
|
||||||
|
|
||||||
|
@ -50,6 +50,7 @@
|
|||||||
|
|
||||||
{% if entry.identifiers|length > 0 %}
|
{% if entry.identifiers|length > 0 %}
|
||||||
<div class="identifiers">
|
<div class="identifiers">
|
||||||
|
<p>
|
||||||
<span class="glyphicon glyphicon-link"></span>
|
<span class="glyphicon glyphicon-link"></span>
|
||||||
{% for identifier in entry.identifiers %}
|
{% for identifier in entry.identifiers %}
|
||||||
<a href="{{identifier}}" target="_blank" class="btn btn-xs btn-success" role="button">{{identifier.formatType()}}</a>
|
<a href="{{identifier}}" target="_blank" class="btn btn-xs btn-success" role="button">{{identifier.formatType()}}</a>
|
||||||
@ -66,10 +67,16 @@
|
|||||||
{% for tag in entry.tags %}
|
{% for tag in entry.tags %}
|
||||||
<a href="{{ url_for('category', id=tag.id) }}" class="btn btn-xs btn-info" role="button">{{tag.name}}</a>
|
<a href="{{ url_for('category', id=tag.id) }}" class="btn btn-xs btn-info" role="button">{{tag.name}}</a>
|
||||||
{%endfor%}
|
{%endfor%}
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</p>
|
</p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
{% if entry.publishers|length > 0 %}
|
||||||
|
<div class="publishers">
|
||||||
|
<p>
|
||||||
|
<span>{{_('Publisher')}}:{% for publisher in entry.publishers %} {{publisher.name}}{% if not loop.last %},{% endif %}{% endfor %}</span>
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% if entry.pubdate[:10] != '0101-01-01' %}
|
{% if entry.pubdate[:10] != '0101-01-01' %}
|
||||||
<p>{{_('Publishing date')}}: {{entry.pubdate|formatdate}} </p>
|
<p>{{_('Publishing date')}}: {{entry.pubdate|formatdate}} </p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
@ -10,63 +10,67 @@
|
|||||||
<label for="bookAuthor">{{_('Author')}}</label>
|
<label for="bookAuthor">{{_('Author')}}</label>
|
||||||
<input type="text" class="form-control typeahead" name="author_name" id="bookAuthor" value="" autocomplete="off">
|
<input type="text" class="form-control typeahead" name="author_name" id="bookAuthor" value="" autocomplete="off">
|
||||||
</div>
|
</div>
|
||||||
<label for="Tags">{{_('Tags')}}</label>
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
|
<label for="Publisher">{{_('Publisher')}}</label>
|
||||||
|
<input type="text" class="form-control" name="publisher" id="publisher" value="">
|
||||||
|
</div>
|
||||||
|
<label for="include_tag">{{_('Tags')}}</label>
|
||||||
|
<div class="form-group" id="test">
|
||||||
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
||||||
{% for tag in tags %}
|
{% for tag in tags %}
|
||||||
<label id="tag_{{tag.id}}" class="btn btn-primary tags_click">
|
<label id="tag_{{tag.id}}" class="btn btn-primary tags_click">
|
||||||
<input type="checkbox" autocomplete="off" name="include_tag" value="{{tag.id}}">{{tag.name}}</input>
|
<input type="checkbox" autocomplete="off" name="include_tag" id="include_tag" value="{{tag.id}}">{{tag.name}}</input>
|
||||||
</label>
|
</label>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label for="Tags">{{_('Exclude Tags')}}</label>
|
<label for="exclude_tag">{{_('Exclude Tags')}}</label>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
||||||
{% for tag in tags %}
|
{% for tag in tags %}
|
||||||
<label id="tag_{{tag.id}}" class="btn btn-danger tags_click">
|
<label id="tag_{{tag.id}}" class="btn btn-danger tags_click">
|
||||||
<input type="checkbox" autocomplete="off" name="exclude_tag" value="{{tag.id}}">{{tag.name}}</input>
|
<input type="checkbox" autocomplete="off" name="exclude_tag" id="exclude_tag" value="{{tag.id}}">{{tag.name}}</input>
|
||||||
</label>
|
</label>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label for="Series">{{_('Series')}}</label>
|
<label for="include_serie">{{_('Series')}}</label>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
||||||
{% for serie in series %}
|
{% for serie in series %}
|
||||||
<label id="serie_{{serie.id}}" class="btn btn-primary serie_click">
|
<label id="serie_{{serie.id}}" class="btn btn-primary serie_click">
|
||||||
<input type="checkbox" autocomplete="off" name="include_serie" value="{{serie.id}}">{{serie.name}}</input>
|
<input type="checkbox" autocomplete="off" name="include_serie" id="include_serie" value="{{serie.id}}">{{serie.name}}</input>
|
||||||
</label>
|
</label>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label for="Series">{{_('Exclude Series')}}</label>
|
<label for="exclude_serie">{{_('Exclude Series')}}</label>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
||||||
{% for serie in series %}
|
{% for serie in series %}
|
||||||
<label id="serie_{{serie.id}}" class="btn btn-danger serie_click">
|
<label id="serie_{{serie.id}}" class="btn btn-danger serie_click">
|
||||||
<input type="checkbox" autocomplete="off" name="exclude_serie" value="{{serie.id}}">{{serie.name}}</input>
|
<input type="checkbox" autocomplete="off" name="exclude_serie" id="exclude_serie" value="{{serie.id}}">{{serie.name}}</input>
|
||||||
</label>
|
</label>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% if languages %}
|
{% if languages %}
|
||||||
<label for="Languages">{{_('Languages')}}</label>
|
<label for="include_language">{{_('Languages')}}</label>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
||||||
{% for language in languages %}
|
{% for language in languages %}
|
||||||
<label id="language_{{language.id}}" class="btn btn-primary serie_click">
|
<label id="language_{{language.id}}" class="btn btn-primary serie_click">
|
||||||
<input type="checkbox" autocomplete="off" name="include_language" value="{{language.id}}">{{language.name}}</input>
|
<input type="checkbox" autocomplete="off" name="include_language" id="include_language" value="{{language.id}}">{{language.name}}</input>
|
||||||
</label>
|
</label>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<label for="Languages">{{_('Exclude Languages')}}</label>
|
<label for="exclude_language">{{_('Exclude Languages')}}</label>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
<div class="btn-toolbar btn-toolbar-lg" data-toggle="buttons">
|
||||||
{% for language in languages %}
|
{% for language in languages %}
|
||||||
<label id="language_{{language.id}}" class="btn btn-danger language_click">
|
<label id="language_{{language.id}}" class="btn btn-danger language_click">
|
||||||
<input type="checkbox" autocomplete="off" name="exclude_language" value="{{language.id}}">{{language.name}}</input>
|
<input type="checkbox" autocomplete="off" name="exclude_language" id="exclude_language" value="{{language.id}}">{{language.name}}</input>
|
||||||
</label>
|
</label>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
35
cps/web.py
35
cps/web.py
@ -473,8 +473,10 @@ 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.authors.any(db.Authors.name.like("%" + term + "%")),
|
db.Books.series.any(db.Series.name.like("%" + term + "%")),
|
||||||
db.Books.title.like("%" + term + "%"))).filter(filter).all()
|
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()
|
||||||
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)
|
||||||
xml = render_title_template('feed.xml', searchterm=term, entries=entries, pagination=pagination)
|
xml = render_title_template('feed.xml', searchterm=term, entries=entries, pagination=pagination)
|
||||||
@ -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":
|
||||||
status['status']=helper.updater_thread.get_update_status()
|
try:
|
||||||
|
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()
|
||||||
@ -1084,9 +1089,10 @@ def search():
|
|||||||
else:
|
else:
|
||||||
filter = True
|
filter = True
|
||||||
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.title.like("%" + term + "%"))).filter(filter).all()
|
db.Books.publishers.any(db.Publishers.name.like("%" + term + "%")),
|
||||||
|
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:
|
||||||
return render_title_template('search.html', searchterm="")
|
return render_title_template('search.html', searchterm="")
|
||||||
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user