1
0
mirror of https://github.com/janeczku/calibre-web synced 2025-10-23 19:37:40 +00:00

Fix pdf cover

Fix massadding books
Add feature inform of duplicate books
This commit is contained in:
Ozzieisaacs
2019-11-26 08:19:03 +01:00
parent ab5873984e
commit 78f9ee86b1
7 changed files with 136 additions and 34 deletions

View File

@@ -780,7 +780,17 @@ def get_download_link(book_id, book_format):
else:
abort(404)
def check_exists_book(authr,title):
db.session.connection().connection.connection.create_function("lower", 1, lcase)
q = list()
authorterms = re.split(r'\s*&\s*', authr)
for authorterm in authorterms:
q.append(db.Books.authors.any(func.lower(db.Authors.name).ilike("%" + authorterm + "%")))
return db.session.query(db.Books).filter(
and_(db.Books.authors.any(and_(*q)),
func.lower(db.Books.title).ilike("%" + title + "%")
)).first()
############### Database Helper functions