diff --git a/src/calibre/gui2/viewer/ui.py b/src/calibre/gui2/viewer/ui.py index 5a7c953795..edabdabd2a 100644 --- a/src/calibre/gui2/viewer/ui.py +++ b/src/calibre/gui2/viewer/ui.py @@ -444,7 +444,10 @@ class EbookViewer(MainWindow): merge_annotations(parse_annotations(raw), amap) def update_window_title(self): - title = self.current_book_data['metadata']['title'] + try: + title = self.current_book_data['metadata']['title'] + except Exception: + title = _('Unknown') book_format = self.current_book_data['manifest']['book_format'] title = '{} [{}] — {}'.format(title, book_format, self.base_window_title) self.setWindowTitle(title) diff --git a/src/pyj/read_book/open_book.pyj b/src/pyj/read_book/open_book.pyj index 17b86a904e..2b10fc333e 100644 --- a/src/pyj/read_book/open_book.pyj +++ b/src/pyj/read_book/open_book.pyj @@ -32,7 +32,7 @@ def create_open_book(container, book): fname = entry.pathtoebook.replace(/\\/g, '/') if '/' in fname: fname = fname.rpartition('/')[-1] - items.push(create_item(entry.title, ui_operations.ask_for_open.bind(None, entry.pathtoebook), fname)) + items.push(create_item(entry.title or _('Unknown'), ui_operations.ask_for_open.bind(None, entry.pathtoebook), fname)) create_item_list(c.lastChild, items) c.appendChild(E.div(style='margin: 1rem')) diff --git a/src/pyj/read_book/view.pyj b/src/pyj/read_book/view.pyj index c104e8bf00..bba43543c7 100644 --- a/src/pyj/read_book/view.pyj +++ b/src/pyj/read_book/view.pyj @@ -575,7 +575,7 @@ class View: self.overlay.show_loading_message(msg) def show_loading(self): - msg = _('Loading next section from {title}, please wait…').format(title=self.book.metadata.title) + msg = _('Loading next section from {title}, please wait…').format(title=self.book.metadata.title or _('Unknown')) if self.show_loading_callback_timer is not None: clearTimeout(self.show_loading_callback_timer) self.show_loading_callback_timer = setTimeout(self.show_loading_message.bind(None, msg), 200)