|
48 | 48 | from .file_helper import validate_mime_type |
49 | 49 | from .usermanagement import user_login_required, login_required_if_no_ano |
50 | 50 | from .string_helper import strip_whitespaces |
| 51 | +from kosync import update_document_hash |
51 | 52 |
|
52 | 53 | editbook = Blueprint('edit-book', __name__) |
53 | 54 | log = logger.create() |
@@ -145,7 +146,8 @@ def upload(): |
145 | 146 | calibre_db.set_metadata_dirty(book_id) |
146 | 147 | # save data to database, reread data |
147 | 148 | calibre_db.session.commit() |
148 | | - |
| 149 | + # update document_hash for kosync |
| 150 | + update_document_hash(book_id) |
149 | 151 | if config.config_use_google_drive: |
150 | 152 | gdriveutils.updateGdriveCalibreFromLocal() |
151 | 153 | if error: |
@@ -307,6 +309,7 @@ def edit_list_book(param): |
307 | 309 | book.last_modified = datetime.now(timezone.utc) |
308 | 310 |
|
309 | 311 | calibre_db.session.commit() |
| 312 | + update_document_hash(book.id) |
310 | 313 | # revert change for sort if automatic fields link is deactivated |
311 | 314 | if param == 'title' and vals.get('checkT') == "false": |
312 | 315 | book.sort = sort_param |
@@ -424,6 +427,7 @@ def table_xchange_author_title(): |
424 | 427 | calibre_db.set_metadata_dirty(book.id) |
425 | 428 | try: |
426 | 429 | calibre_db.session.commit() |
| 430 | + update_document_hash(book.id) |
427 | 431 | except (OperationalError, IntegrityError, StaleDataError) as e: |
428 | 432 | calibre_db.session.rollback() |
429 | 433 | log.error_or_exception("Database error: {}".format(e)) |
@@ -552,6 +556,7 @@ def do_edit_book(book_id, upload_formats=None): |
552 | 556 |
|
553 | 557 | calibre_db.session.merge(book) |
554 | 558 | calibre_db.session.commit() |
| 559 | + update_document_hash(book.id) |
555 | 560 | if config.config_use_google_drive: |
556 | 561 | gdriveutils.updateGdriveCalibreFromLocal() |
557 | 562 | if edit_error is not True and title_author_error is not True and cover_upload_success is not False: |
|
0 commit comments