Merge branch 'development' into cover_thumb

# Conflicts:
#	cps/admin.py
This commit is contained in:
Ozzie Isaacs 2021-03-21 07:29:35 +01:00
commit 10731696df
6 changed files with 186 additions and 175 deletions

1
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1 @@
blank_issues_enabled: false

View File

@ -31,7 +31,6 @@ from datetime import datetime, timedelta
from babel import Locale as LC
from babel.dates import format_datetime
from babel.core import UnknownLocaleError
from flask import Blueprint, flash, redirect, url_for, abort, request, make_response, send_from_directory, g
from flask_login import login_required, current_user, logout_user, confirm_login
from flask_babel import gettext as _
@ -63,7 +62,7 @@ feature_support = {
}
try:
import rarfile
import rarfile # pylint: disable=unused-import
feature_support['rar'] = True
except (ImportError, SyntaxError):
feature_support['rar'] = False
@ -301,7 +300,6 @@ def list_users():
@admin_required
def delete_user():
# ToDo User delete check also not last one
pass
return ""
@admi.route("/ajax/getlocale")

View File

@ -403,6 +403,39 @@ $("div.comments").readmore({
// End of Global Work //
///////////////////////////////
// Advanced Search Results
if($("body.advsearch").length > 0) {
$("#loader + .container-fluid")
.prepend("<div class='blur-wrapper'></div>");
$("#add-to-shelves").insertBefore(".blur-wrapper");
$('div[aria-label="Add to shelves"]').click(function () {
$("#add-to-shelves").toggle();
});
$('#add-to-shelf').height("40px");
function dropdownToggle() {
topPos = $("#add-to-shelf").offset().top-20;
if ($('div[aria-label="Add to shelves"]').length > 0) {
position = $('div[aria-label="Add to shelves"]').offset().left
if (position + $("#add-to-shelves").width() > $(window).width()) {
positionOff = position + $("#add-to-shelves").width() - $(window).width();
adsPosition = position - positionOff - 5
$("#add-to-shelves").attr("style", "left: " + adsPosition + "px !important; right: auto; top: " + topPos + "px");
} else {
$("#add-to-shelves").attr("style", "left: " + position + "px !important; right: auto; top: " + topPos + "px");
}
}
}
dropdownToggle();
$(window).on("resize", function () {
dropdownToggle();
});
}
// Author Page Background Blur
if ($("body.author").length > 0) {
cover = $(".author-bio img").attr("src");

View File

@ -16,20 +16,20 @@
<input type="text" class="form-control" name="publisher" id="publisher" value="">
</div>
<div class="row">
<div class="form-group col-sm-6">
<label for="Publishstart">{{_('Published Date From')}}</label>
<div style="position: relative">
<input type="date" class="form-control" name="Publishstart" id="Publishstart" value="">
<input type="text" class="form-control fake-input hidden" id="fake_Publishstart" value="">
</div>
<div class="form-group col-sm-6">
<label for="Publishstart">{{_('Published Date From')}}</label>
<div style="position: relative">
<input type="date" class="form-control" name="Publishstart" id="Publishstart" value="">
<input type="text" class="form-control fake-input hidden" id="fake_Publishstart" value="">
</div>
<div class="form-group col-sm-6">
<label for="Publishend">{{_('Published Date To')}}</label>
<div style="position: relative">
<input type="date" class="form-control" name="Publishend" id="Publishend" value="">
<input type="text" class="form-control fake-input hidden" id="fake_Publishend" value="">
</div>
</div>
<div class="form-group col-sm-6">
<label for="Publishend">{{_('Published Date To')}}</label>
<div style="position: relative">
<input type="date" class="form-control" name="Publishend" id="Publishend" value="">
<input type="text" class="form-control fake-input hidden" id="fake_Publishend" value="">
</div>
</div>
</div>
<div class="form-group">
<label for="read_status">{{_('Read Status')}}</label>
@ -42,17 +42,17 @@
<div class="row">
<div class="form-group col-sm-6" id="tag">
<div><label for="include_tag">{{_('Tags')}}</label></div>
<select class="selectpicker" name="include_tag" id="include_tag" data-live-search="true" data-style="btn-primary" multiple>
<select class="selectpicker" name="include_tag" id="include_tag" data-live-search="true" data-style="btn-primary" data-dropup-auto="false" multiple>
{% for tag in tags %}
<option class="tags_click" value="{{tag.id}}">{{tag.name}}</option>
<option class="tags_click" value="{{tag.id}}">{{tag.name}}</option>
{% endfor %}
</select>
</div>
<div class="form-group col-sm-6">
<div><label for="exclude_tag">{{_('Exclude Tags')}}</label></div>
<select class="selectpicker" name="exclude_tag" id="exclude_tag" data-live-search="true" data-style="btn-danger" multiple>
<select class="selectpicker" name="exclude_tag" id="exclude_tag" data-live-search="true" data-style="btn-danger" data-dropup-auto="false" multiple>
{% for tag in tags %}
<option class="tags_click" value="{{tag.id}}">{{tag.name}}</option>
<option class="tags_click" value="{{tag.id}}">{{tag.name}}</option>
{% endfor %}
</select>
</div>
@ -60,64 +60,83 @@
<div class="row">
<div class="form-group col-sm-6">
<div><label for="include_serie">{{_('Series')}}</label></div>
<select class="selectpicker" name="include_serie" id="include_serie" data-live-search="true" data-style="btn-primary" multiple>
<select class="selectpicker" name="include_serie" id="include_serie" data-live-search="true" data-style="btn-primary" data-dropup-auto="false" data-actions-box="true" multiple>
{% for serie in series %}
<option value="{{serie.id}}">{{serie.name}}</option>
<option value="{{serie.id}}">{{serie.name}}</option>
{% endfor %}
</select>
</div>
<div class="form-group col-sm-6">
<div><label for="exclude_serie">{{_('Exclude Series')}}</label></div>
<select class="selectpicker" name="exclude_serie" id="exclude_serie" data-live-search="true" data-style="btn-danger" multiple>
<select class="selectpicker" name="exclude_serie" id="exclude_serie" data-live-search="true" data-style="btn-danger" data-dropup-auto="false" data-actions-box="true" multiple>
{% for serie in series %}
<option value="{{serie.id}}">{{serie.name}}</option>
<option value="{{serie.id}}">{{serie.name}}</option>
{% endfor %}
</select>
</div>
</div>
<div class="row">
<div class="form-group col-sm-6">
<div><label for="include_shelf">{{_('Shelves')}}</label></div>
<select class="selectpicker" name="include_shelf" id="include_shelf" data-live-search="true" data-style="btn-primary" data-dropup-auto="false" data-actions-box="true" multiple>
{% for shelf in shelves %}
<option value="{{shelf.id}}">{{shelf.name}}</option>
{% endfor %}
</select>
</div>
<div class="form-group col-sm-6">
<div><label for="exclude_shelf">{{_('Exclude Shelves')}}</label></div>
<select class="selectpicker" name="exclude_shelf" id="exclude_shelf" data-live-search="true" data-style="btn-danger" data-dropup-auto="false" data-actions-box="true" multiple>
{% for shelf in shelves %}
<option value="{{shelf.id}}">{{shelf.name}}</option>
{% endfor %}
</select>
</div>
</div>
{% if languages %}
<div class="row">
<div class="form-group col-sm-6">
<div><label for="include_language">{{_('Languages')}}</label></div>
<select class="selectpicker" name="include_language" id="include_language" data-live-search="true" data-style="btn-primary" multiple>
<select class="selectpicker" name="include_language" id="include_language" data-live-search="true" data-style="btn-primary" data-dropup-auto="false" data-actions-box="true" multiple>
{% for language in languages %}
<option value="{{language.id}}">{{language.name}}</option>
<option value="{{language.id}}">{{language.name}}</option>
{% endfor %}
</select>
</div>
<div class="form-group col-sm-6">
<div><label for="exclude_language">{{_('Exclude Languages')}}</label></div>
<select class="selectpicker" name="exclude_language" id="exclude_language" data-live-search="true" data-style="btn-danger" multiple>
<select class="selectpicker" name="exclude_language" id="exclude_language" data-live-search="true" data-style="btn-danger" data-dropup-auto="false" data-actions-box="true" multiple>
{% for language in languages %}
<option value="{{language.id}}">{{language.name}}</option>
<option value="{{language.id}}">{{language.name}}</option>
{% endfor %}
</select>
</div>
</div>
{% endif%}
<div class="row">
<div class="form-group col-sm-6">
<div class="form-group col-sm-6">
<div><label for="include_extension">{{_('Extensions')}}</label></div>
<select class="selectpicker" name="include_extension" id="include_extension" data-live-search="true" data-style="btn-primary" multiple>
{% for extension in extensions %}
<option value="{{extension.format}}">{{extension.format}}</option>
<select class="selectpicker" name="include_extension" id="include_extension" data-live-search="true" data-style="btn-primary" data-dropup-auto="false" data-actions-box="true" multiple>
{% for extension in extensions %}
<option value="{{extension.format}}">{{extension.format}}</option>
{% endfor %}
</select>
</div>
<div class="form-group col-sm-6">
</div>
<div class="form-group col-sm-6">
<div><label for="exclude_extension">{{_('Exclude Extensions')}}</label></div>
<select class="selectpicker" name="exclude_extension" id="exclude_extension" data-live-search="true" data-style="btn-danger" multiple>
{% for extension in extensions %}
<option value="{{extension.format}}">{{extension.format}}</option>
<select class="selectpicker" name="exclude_extension" id="exclude_extension" data-live-search="true" data-style="btn-danger" data-dropup-auto="false" data-actions-box="true" multiple>
{% for extension in extensions %}
<option value="{{extension.format}}">{{extension.format}}</option>
{% endfor %}
</select>
</div>
</div>
</div>
<div class="row">
<div class="form-group col-sm-6">
<label for="ratinghigh">{{_('Rating Above')}}</label>
<input type="number" name="ratinghigh" id="ratinghigh" class="rating input-lg" data-clearable="" >
</div>
<div class="form-group col-sm-6">
<label for="ratinghigh">{{_('Rating Above')}}</label>
<input type="number" name="ratinghigh" id="ratinghigh" class="rating input-lg" data-clearable="" >
</div>
<div class="form-group col-sm-6">
<label for="ratinglow">{{_('Rating Below')}}</label>
<input type="number" name="ratinglow" id="ratinglow" class="rating input-lg" data-clearable="" >
@ -129,47 +148,47 @@
</div>
{% if cc|length > 0 %}
{% for c in cc %}
<div class="form-group">
<label for="{{ 'custom_column_' ~ c.id }}">{{ c.name }}</label>
{% if c.datatype == 'bool' %}
<select name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" class="form-control">
<option value="" selected></option>
<option value="True" >{{_('Yes')}}</option>
<option value="False" >{{_('No')}}</option>
</select>
{% endif %}
{% for c in cc %}
<div class="form-group">
<label for="{{ 'custom_column_' ~ c.id }}">{{ c.name }}</label>
{% if c.datatype == 'bool' %}
<select name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" class="form-control">
<option value="" selected></option>
<option value="True" >{{_('Yes')}}</option>
<option value="False" >{{_('No')}}</option>
</select>
{% endif %}
{% if c.datatype == 'int' %}
<input type="number" step="1" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" value="">
{% endif %}
{% if c.datatype == 'int' %}
<input type="number" step="1" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" value="">
{% endif %}
{% if c.datatype == 'float' %}
<input type="number" step="0.01" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" value="">
{% endif %}
{% if c.datatype == 'float' %}
<input type="number" step="0.01" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" value="">
{% endif %}
{% if c.datatype in ['text', 'series'] and not c.is_multiple %}
<input type="text" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" value="">
{% endif %}
{% if c.datatype in ['text', 'series'] and not c.is_multiple %}
<input type="text" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" value="">
{% endif %}
{% if c.datatype in ['text', 'series'] and c.is_multiple %}
<input type="text" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" value="">
{% endif %}
{% if c.datatype in ['text', 'series'] and c.is_multiple %}
<input type="text" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}" value="">
{% endif %}
{% if c.datatype == 'enumeration' %}
<select class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}">
<option></option>
{% for opt in c.get_display_dict().enum_values %}
<option>{{ opt }}</option>
{% endfor %}
</select>
{% endif %}
{% if c.datatype == 'enumeration' %}
<select class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}">
<option></option>
{% for opt in c.get_display_dict().enum_values %}
<option>{{ opt }}</option>
{% endfor %}
</select>
{% endif %}
{% if c.datatype == 'rating' %}
<input type="number" min="1" max="5" step="0.5" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}">
{% endif %}
</div>
{% endfor %}
{% if c.datatype == 'rating' %}
<input type="number" min="1" max="5" step="0.5" class="form-control" name="{{ 'custom_column_' ~ c.id }}" id="{{ 'custom_column_' ~ c.id }}">
{% endif %}
</div>
{% endfor %}
{% endif %}
<button type="submit" id="adv_submit" class="btn btn-default">{{_('Search')}}</button>

View File

@ -22,7 +22,7 @@ import hashlib
from tempfile import gettempdir
from flask_babel import gettext as _
from . import logger, comic, isoLanguages, get_locale
from . import logger, comic, isoLanguages
from .constants import BookMeta
from .helper import split_authors
@ -53,7 +53,7 @@ except ImportError as ex:
from PyPDF2 import __version__ as PyPdfVersion
use_pdf_meta = True
except ImportError as e:
log.debug('Cannot import PyPDF3/PyPDF2, extracting pdf metadata will not work: %s / %s', e)
log.debug('Cannot import PyPDF3/PyPDF2, extracting pdf metadata will not work: %s / %s', ex, e)
use_pdf_meta = False
try:
@ -86,7 +86,7 @@ def process(tmp_file_path, original_file_name, original_file_extension, rarExecu
original_file_name,
original_file_extension,
rarExecutable)
except Exception as ex:
except Exception as ex:
log.warning('cannot parse metadata, using default: %s', ex)
if meta and meta.title.strip() and meta.author.strip():
@ -113,12 +113,12 @@ def default_meta(tmp_file_path, original_file_name, original_file_extension):
def parse_xmp(pdf_file):
"""
Parse XMP Metadata and prepare for BookMeta object
Parse XMP Metadata and prepare for BookMeta object
"""
try:
xmp_info = pdf_file.getXmpMetadata()
except Exception as e:
log.debug('Can not read XMP metadata', e)
log.debug('Can not read XMP metadata %e', e)
return None
if xmp_info:
@ -126,8 +126,8 @@ def parse_xmp(pdf_file):
xmp_author = xmp_info.dc_creator # list
except AttributeError:
xmp_author = ['']
if xmp_info.dc_title:
if xmp_info.dc_title:
xmp_title = xmp_info.dc_title['x-default']
else:
xmp_title = ''
@ -142,9 +142,9 @@ def parse_xmp(pdf_file):
for i in xmp_info.dc_language:
#calibre-web currently only takes one language.
languages.append(isoLanguages.get_lang3(i))
except:
except AttributeError:
languages.append('')
xmp_tags = ', '.join(xmp_info.dc_subject)
xmp_publisher = ', '.join(xmp_info.dc_publisher)
@ -156,51 +156,6 @@ def parse_xmp(pdf_file):
}
def parse_xmp(pdf_file):
"""
Parse XMP Metadata and prepare for BookMeta object
"""
try:
xmp_info = pdf_file.getXmpMetadata()
except Exception as e:
log.debug('Can not read XMP metadata', e)
return None
if xmp_info:
try:
xmp_author = xmp_info.dc_creator # list
except:
xmp_author = ['']
if xmp_info.dc_title:
xmp_title = xmp_info.dc_title['x-default']
else:
xmp_title = ''
if xmp_info.dc_description:
xmp_description = xmp_info.dc_description['x-default']
else:
xmp_description = ''
languages = []
try:
for i in xmp_info.dc_language:
languages.append(isoLanguages.get_lang3(i))
except AttributeError:
languages= [""]
xmp_tags = ', '.join(xmp_info.dc_subject)
xmp_publisher = ', '.join(xmp_info.dc_publisher)
return {'author': xmp_author,
'title': xmp_title,
'subject': xmp_description,
'tags': xmp_tags,
'languages': languages,
'publisher': xmp_publisher
}
def parse_xmp(pdf_file):
"""
Parse XMP Metadata and prepare for BookMeta object

View File

@ -37,7 +37,7 @@ from flask import session as flask_session
from flask_babel import gettext as _
from flask_login import login_user, logout_user, login_required, current_user
from sqlalchemy.exc import IntegrityError, InvalidRequestError, OperationalError
from sqlalchemy.sql.expression import text, func, false, not_, and_
from sqlalchemy.sql.expression import text, func, false, not_, and_, or_
from sqlalchemy.orm.attributes import flag_modified
from sqlalchemy.sql.functions import coalesce
@ -711,6 +711,9 @@ def render_prepare_search_form(cc):
.group_by(text('books_series_link.series'))\
.order_by(db.Series.name)\
.filter(calibre_db.common_filters()).all()
shelves = ub.session.query(ub.Shelf)\
.filter(or_(ub.Shelf.is_public == 1, ub.Shelf.user_id == int(current_user.id)))\
.order_by(ub.Shelf.name).all()
extensions = calibre_db.session.query(db.Data)\
.join(db.Books)\
.filter(calibre_db.common_filters()) \
@ -721,7 +724,7 @@ def render_prepare_search_form(cc):
else:
languages = None
return render_title_template('search_form.html', tags=tags, languages=languages, extensions=extensions,
series=series, title=_(u"Advanced Search"), cc=cc, page="advsearch")
series=series,shelves=shelves, title=_(u"Advanced Search"), cc=cc, page="advsearch")
def render_search_results(term, offset=None, order=None, limit=None):
@ -1020,7 +1023,7 @@ def search():
@login_required_if_no_ano
def advanced_search():
values = dict(request.form)
params = ['include_tag', 'exclude_tag', 'include_serie', 'exclude_serie', 'include_language',
params = ['include_tag', 'exclude_tag', 'include_serie', 'exclude_serie', 'include_shelf','exclude_shelf','include_language',
'exclude_language', 'include_extension', 'exclude_extension']
for param in params:
values[param] = list(request.form.getlist(param))
@ -1112,6 +1115,12 @@ def adv_search_serie(q, include_series_inputs, exclude_series_inputs):
q = q.filter(not_(db.Books.series.any(db.Series.id == serie)))
return q
def adv_search_shelf(q, include_shelf_inputs, exclude_shelf_inputs):
q = q.outerjoin(ub.BookShelf, db.Books.id == ub.BookShelf.book_id)\
.filter(or_(ub.BookShelf.shelf == None, ub.BookShelf.shelf.notin_(exclude_shelf_inputs)))
if len(include_shelf_inputs) > 0:
q = q.filter(ub.BookShelf.shelf.in_(include_shelf_inputs))
return q
def extend_search_term(searchterm,
author_name,
@ -1119,16 +1128,10 @@ def extend_search_term(searchterm,
publisher,
pub_start,
pub_end,
include_tag_inputs,
exclude_tag_inputs,
include_series_inputs,
exclude_series_inputs,
include_languages_inputs,
tags,
rating_high,
rating_low,
read_status,
include_extension_inputs,
exclude_extension_inputs
):
searchterm.extend((author_name.replace('|', ','), book_title, publisher))
if pub_start:
@ -1145,16 +1148,27 @@ def extend_search_term(searchterm,
format='medium', locale=get_locale())])
except ValueError:
pub_start = u""
tag_names = calibre_db.session.query(db.Tags).filter(db.Tags.id.in_(include_tag_inputs)).all()
searchterm.extend(tag.name for tag in tag_names)
tag_names = calibre_db.session.query(db.Tags).filter(db.Tags.id.in_(exclude_tag_inputs)).all()
searchterm.extend(tag.name for tag in tag_names)
serie_names = calibre_db.session.query(db.Series).filter(db.Series.id.in_(include_series_inputs)).all()
searchterm.extend(serie.name for serie in serie_names)
serie_names = calibre_db.session.query(db.Series).filter(db.Series.id.in_(exclude_series_inputs)).all()
searchterm.extend(serie.name for serie in serie_names)
elements = {'tag': db.Tags, 'serie':db.Series, 'shelf':ub.Shelf}
for key, db_element in elements.items():
tag_names = calibre_db.session.query(db_element).filter(db_element.id.in_(tags['include_' + key])).all()
searchterm.extend(tag.name for tag in tag_names)
tag_names = calibre_db.session.query(db_element).filter(db.Tags.id.in_(tags['exclude_' + key])).all()
searchterm.extend(tag.name for tag in tag_names)
#serie_names = calibre_db.session.query(db.Series).filter(db.Series.id.in_(tags['include_serie'])).all()
#searchterm.extend(serie.name for serie in serie_names)
#serie_names = calibre_db.session.query(db.Series).filter(db.Series.id.in_(tags['include_serie'])).all()
#searchterm.extend(serie.name for serie in serie_names)
#shelf_names = ub.session.query(ub.Shelf).filter(ub.Shelf.id.in_(tags['include_shelf'])).all()
#searchterm.extend(shelf.name for shelf in shelf_names)
#shelf_names = ub.session.query(ub.Shelf).filter(ub.Shelf.id.in_(tags['include_shelf'])).all()
#searchterm.extend(shelf.name for shelf in shelf_names)
language_names = calibre_db.session.query(db.Languages). \
filter(db.Languages.id.in_(include_languages_inputs)).all()
filter(db.Languages.id.in_(tags['include_language'])).all()
if language_names:
language_names = calibre_db.speaking_language(language_names)
searchterm.extend(language.name for language in language_names)
language_names = calibre_db.session.query(db.Languages). \
filter(db.Languages.id.in_(tags['exclude_language'])).all()
if language_names:
language_names = calibre_db.speaking_language(language_names)
searchterm.extend(language.name for language in language_names)
@ -1164,8 +1178,8 @@ def extend_search_term(searchterm,
searchterm.extend([_(u"Rating >= %(rating)s", rating=rating_low)])
if read_status:
searchterm.extend([_(u"Read Status = %(status)s", status=read_status)])
searchterm.extend(ext for ext in include_extension_inputs)
searchterm.extend(ext for ext in exclude_extension_inputs)
searchterm.extend(ext for ext in tags['include_extension'])
searchterm.extend(ext for ext in tags['exclude_extension'])
# handle custom columns
searchterm = " + ".join(filter(None, searchterm))
return searchterm, pub_start, pub_end
@ -1179,14 +1193,12 @@ def render_adv_search_results(term, offset=None, order=None, limit=None):
calibre_db.session.connection().connection.connection.create_function("lower", 1, db.lcase)
q = calibre_db.session.query(db.Books).filter(calibre_db.common_filters(True))
include_tag_inputs = term.get('include_tag')
exclude_tag_inputs = term.get('exclude_tag')
include_series_inputs = term.get('include_serie')
exclude_series_inputs = term.get('exclude_serie')
include_languages_inputs = term.get('include_language')
exclude_languages_inputs = term.get('exclude_language')
include_extension_inputs = term.get('include_extension')
exclude_extension_inputs = term.get('exclude_extension')
# parse multiselects to a complete dict
tags = dict()
elements = ['tag', 'serie', 'shelf', 'language', 'extension']
for element in elements:
tags['include_' + element] = term.get('include_' + element)
tags['exclude_' + element] = term.get('exclude_' + element)
author_name = term.get("author_name")
book_title = term.get("book_title")
@ -1211,26 +1223,18 @@ def render_adv_search_results(term, offset=None, order=None, limit=None):
searchterm.extend([(u"%s: %s" % (c.name, term.get('custom_column_' + str(c.id))))])
cc_present = True
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 or \
publisher or pub_start or pub_end or rating_low or rating_high or description or cc_present or \
include_extension_inputs or exclude_extension_inputs or read_status:
if any(tags.values()) or author_name or book_title or publisher or pub_start or pub_end or rating_low \
or rating_high or description or cc_present or read_status:
searchterm, pub_start, pub_end = extend_search_term(searchterm,
author_name,
book_title,
publisher,
pub_start,
pub_end,
include_tag_inputs,
exclude_tag_inputs,
include_series_inputs,
exclude_series_inputs,
include_languages_inputs,
tags,
rating_high,
rating_low,
read_status,
include_extension_inputs,
exclude_extension_inputs)
read_status)
q = q.filter()
if author_name:
q = q.filter(db.Books.authors.any(func.lower(db.Authors.name).ilike("%" + author_name + "%")))
@ -1243,10 +1247,11 @@ def render_adv_search_results(term, offset=None, order=None, limit=None):
q = adv_search_read_status(q, read_status)
if publisher:
q = q.filter(db.Books.publishers.any(func.lower(db.Publishers.name).ilike("%" + publisher + "%")))
q = adv_search_tag(q, include_tag_inputs, exclude_tag_inputs)
q = adv_search_serie(q, include_series_inputs, exclude_series_inputs)
q = adv_search_extension(q, include_extension_inputs, exclude_extension_inputs)
q = adv_search_language(q, include_languages_inputs, exclude_languages_inputs)
q = adv_search_tag(q, tags['include_tag'], tags['exclude_tag'])
q = adv_search_serie(q, tags['include_serie'], tags['exclude_serie'])
q = adv_search_shelf(q, tags['include_shelf'], tags['exclude_shelf'])
q = adv_search_extension(q, tags['include_extension'], tags['exclude_extension'])
q = adv_search_language(q, tags['include_language'], tags['exclude_language'])
q = adv_search_ratings(q, rating_high, rating_low)
if description: