mirror of
https://github.com/janeczku/calibre-web
synced 2024-12-26 18:10:30 +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)
|
# handle author(s)
|
||||||
input_authors = prepare_authors(author_name, config.get_book_path(), config.config_use_google_drive)
|
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
|
# 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
|
# everything then is assembled for sorted author field in database
|
||||||
sort_authors_list = list()
|
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:
|
for add_element in add_elements:
|
||||||
# check if an element with that name exists
|
# check if an element with that name exists
|
||||||
changed = True
|
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))).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()
|
|
||||||
# if no element is found add it
|
# if no element is found add it
|
||||||
if db_element is None:
|
if not db_element:
|
||||||
if db_type == 'author':
|
if db_type == 'author':
|
||||||
new_element = db_object(add_element, helper.get_sorted_author(add_element.replace('|', ',')))
|
new_element = db_object(add_element, helper.get_sorted_author(add_element.replace('|', ',')))
|
||||||
elif db_type == 'series':
|
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_session.add(new_element)
|
||||||
db_book_object.append(new_element)
|
db_book_object.append(new_element)
|
||||||
else:
|
else:
|
||||||
db_no_case = db_session.query(db_object).filter(db_filter == add_element).first()
|
if len(db_element) == 1:
|
||||||
if db_no_case:
|
db_element = create_objects_for_addition(db_element[0], add_element, db_type)
|
||||||
# check for new case of element
|
else:
|
||||||
db_element = create_objects_for_addition(db_element, add_element, db_type)
|
db_el = db_session.query(db_object).filter(db_filter == add_element).first()
|
||||||
#else:
|
db_element = db_element[0] if not db_el else db_el
|
||||||
# db_element = create_objects_for_addition(db_element, add_element, db_type)
|
|
||||||
# add element to book
|
# add element to book
|
||||||
db_book_object.append(db_element)
|
db_book_object.append(db_element)
|
||||||
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user