From 8aa7031c9eb41af693565a084c331971cb4e037e Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Oct 2010 13:06:38 -0600 Subject: [PATCH 1/3] Fix #7043 (Instant Search for text not found causes unhandled exception when conversion jobs are running) --- src/calibre/gui2/actions/convert.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/calibre/gui2/actions/convert.py b/src/calibre/gui2/actions/convert.py index 29acfc52b1..3828e9e1bf 100644 --- a/src/calibre/gui2/actions/convert.py +++ b/src/calibre/gui2/actions/convert.py @@ -181,5 +181,6 @@ class ConvertAction(InterfaceAction): self.gui.tags_view.recount() if self.gui.current_view() is self.gui.library_view: current = self.gui.library_view.currentIndex() - self.gui.library_view.model().current_changed(current, QModelIndex()) + if current.isValid(): + self.gui.library_view.model().current_changed(current, QModelIndex()) From 1c54f129a7476eed529d7cdcafcdb5744a9fe644 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Oct 2010 13:08:28 -0600 Subject: [PATCH 2/3] ... --- src/calibre/gui2/library/models.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/calibre/gui2/library/models.py b/src/calibre/gui2/library/models.py index 19bd38e08f..4033d3c98d 100644 --- a/src/calibre/gui2/library/models.py +++ b/src/calibre/gui2/library/models.py @@ -361,13 +361,14 @@ class BooksModel(QAbstractTableModel): # {{{ self.cover_cache.set_cache(ids) def current_changed(self, current, previous, emit_signal=True): - idx = current.row() - self.set_cache(idx) - data = self.get_book_display_info(idx) - if emit_signal: - self.new_bookdisplay_data.emit(data) - else: - return data + if current.isValid(): + idx = current.row() + self.set_cache(idx) + data = self.get_book_display_info(idx) + if emit_signal: + self.new_bookdisplay_data.emit(data) + else: + return data def get_book_info(self, index): if isinstance(index, int): From 6c8746bed93246bdc989c22182c52652af7c1c09 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Sun, 3 Oct 2010 13:30:59 -0600 Subject: [PATCH 3/3] Fix #7054 (Issue while importing book where isbn is present in file name) --- src/calibre/ebooks/metadata/book/__init__.py | 3 ++- src/calibre/ebooks/metadata/meta.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/calibre/ebooks/metadata/book/__init__.py b/src/calibre/ebooks/metadata/book/__init__.py index e6dff9110b..761a573b69 100644 --- a/src/calibre/ebooks/metadata/book/__init__.py +++ b/src/calibre/ebooks/metadata/book/__init__.py @@ -114,7 +114,8 @@ SC_COPYABLE_FIELDS = SOCIAL_METADATA_FIELDS.union( PUBLICATION_METADATA_FIELDS).union( BOOK_STRUCTURE_FIELDS).union( DEVICE_METADATA_FIELDS).union( - CALIBRE_METADATA_FIELDS) - \ + CALIBRE_METADATA_FIELDS).union( + TOP_LEVEL_CLASSIFIERS) - \ SC_FIELDS_NOT_COPIED.union( SC_FIELDS_COPY_NOT_NULL) diff --git a/src/calibre/ebooks/metadata/meta.py b/src/calibre/ebooks/metadata/meta.py index b02ae2dbff..87b8d3b535 100644 --- a/src/calibre/ebooks/metadata/meta.py +++ b/src/calibre/ebooks/metadata/meta.py @@ -108,7 +108,8 @@ def _get_metadata(stream, stream_type, use_libprs_metadata, base = metadata_from_filename(name, pat=pattern) if force_read_metadata or is_recipe(name) or prefs['read_file_metadata']: mi = get_file_type_metadata(stream, stream_type) - if base.title == os.path.splitext(name)[0] and base.authors is None: + if base.title == os.path.splitext(name)[0] and \ + base.is_null('authors') and base.is_null('isbn'): # Assume that there was no metadata in the file and the user set pattern # to match meta info from the file name did not match. # The regex is meant to match the standard format filenames are written