mirror of
https://github.com/janeczku/calibre-web
synced 2024-11-09 11:30:00 +00:00
Fix for renaming tags etc. upon upload (#3058)
This commit is contained in:
commit
9536b2c322
@ -1288,7 +1288,6 @@ def handle_author_on_edit(book, author_name, update_stored=True):
|
||||
# handle author(s)
|
||||
input_authors = prepare_authors(author_name, config.get_book_path(), config.config_use_google_drive)
|
||||
|
||||
# change |= modify_database_object(input_authors, book.authors, db.Authors, calibre_db.session, 'author')
|
||||
# Search for each author if author is in database, if not, author name and sorted author name is generated new
|
||||
# everything then is assembled for sorted author field in database
|
||||
sort_authors_list = list()
|
||||
@ -1368,11 +1367,9 @@ def add_objects(db_book_object, db_object, db_session, db_type, add_elements):
|
||||
for add_element in add_elements:
|
||||
# check if an element with that name exists
|
||||
changed = True
|
||||
# db_session.query(db.Tags).filter((func.lower(db.Tags.name).ilike("GênOt"))).all()
|
||||
db_element = db_session.query(db_object).filter((func.lower(db_filter).ilike(add_element))).first()
|
||||
# db_element = db_session.query(db_object).filter(func.lower(db_filter) == add_element.lower()).first()
|
||||
db_element = db_session.query(db_object).filter((func.lower(db_filter).ilike(add_element))).all()
|
||||
# if no element is found add it
|
||||
if db_element is None:
|
||||
if not db_element:
|
||||
if db_type == 'author':
|
||||
new_element = db_object(add_element, helper.get_sorted_author(add_element.replace('|', ',')))
|
||||
elif db_type == 'series':
|
||||
@ -1386,12 +1383,11 @@ def add_objects(db_book_object, db_object, db_session, db_type, add_elements):
|
||||
db_session.add(new_element)
|
||||
db_book_object.append(new_element)
|
||||
else:
|
||||
db_no_case = db_session.query(db_object).filter(db_filter == add_element).first()
|
||||
if db_no_case:
|
||||
# check for new case of element
|
||||
db_element = create_objects_for_addition(db_element, add_element, db_type)
|
||||
#else:
|
||||
# db_element = create_objects_for_addition(db_element, add_element, db_type)
|
||||
if len(db_element) == 1:
|
||||
db_element = create_objects_for_addition(db_element[0], add_element, db_type)
|
||||
else:
|
||||
db_el = db_session.query(db_object).filter(db_filter == add_element).first()
|
||||
db_element = db_element[0] if not db_el else db_el
|
||||
# add element to book
|
||||
db_book_object.append(db_element)
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user