From 57850237229a4d8dedf9b4be73121e56d2ed4412 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sat, 18 Nov 2023 07:47:33 +0530 Subject: [PATCH] Also allow restoring notes to work with notes backed up before the restore fix --- src/calibre/db/notes/connect.py | 7 ++++++- src/calibre/gui2/dialogs/restore_library.py | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/calibre/db/notes/connect.py b/src/calibre/db/notes/connect.py index 11628fc65a..db170a644d 100644 --- a/src/calibre/db/notes/connect.py +++ b/src/calibre/db/notes/connect.py @@ -498,8 +498,13 @@ class Notes: errors.append(_('Failed to read from document for {path} with error: {error}').format(path=f'{field}:{old_item_id}', error=e)) report_progress('', i) continue + parts = raw.split(SEP, 3) try: - doc, searchable_text, res, old_item_val = (str(x, 'utf-8') for x in raw.split(SEP, 3)) + if len(parts) == 4: + doc, searchable_text, res, old_item_val = (str(x, 'utf-8') for x in parts) + else: + doc, searchable_text, res = (str(x, 'utf-8') for x in parts) + old_item_val = searchable_text.split('\n')[0] except Exception as err: errors.append(_('Failed to parse document for: {0} with error: {1}').format(old_item_id, err)) report_progress('', i) diff --git a/src/calibre/gui2/dialogs/restore_library.py b/src/calibre/gui2/dialogs/restore_library.py index 890eba6a68..46c75b4601 100644 --- a/src/calibre/gui2/dialogs/restore_library.py +++ b/src/calibre/gui2/dialogs/restore_library.py @@ -20,7 +20,7 @@ class DBRestore(QDialog): self.l = QVBoxLayout() self.setLayout(self.l) self.l1 = QLabel(''+_('Restoring database from backups, do not' - ' interrupt, this will happen in three stages')+'...') + ' interrupt, this will happen in multiple stages')+'...') self.setWindowTitle(_('Restoring database')) self.l.addWidget(self.l1) self.pb = QProgressBar(self)