mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ignore non-unicode entries in title table when adding books
This commit is contained in:
parent
2170532391
commit
103ec370d4
@ -13,7 +13,7 @@ from collections import defaultdict, Set, MutableSet
|
|||||||
from functools import wraps, partial
|
from functools import wraps, partial
|
||||||
from future_builtins import zip
|
from future_builtins import zip
|
||||||
|
|
||||||
from calibre import isbytestring
|
from calibre import isbytestring, as_unicode
|
||||||
from calibre.constants import iswindows, preferred_encoding
|
from calibre.constants import iswindows, preferred_encoding
|
||||||
from calibre.customize.ui import run_plugins_on_import, run_plugins_on_postimport
|
from calibre.customize.ui import run_plugins_on_import, run_plugins_on_postimport
|
||||||
from calibre.db import SPOOL_SIZE, _get_next_series_num_for_list
|
from calibre.db import SPOOL_SIZE, _get_next_series_num_for_list
|
||||||
@ -1446,7 +1446,11 @@ class Cache(object):
|
|||||||
''' Return data suitable for use in :meth:`has_book`. This can be used for an
|
''' Return data suitable for use in :meth:`has_book`. This can be used for an
|
||||||
implementation of :meth:`has_book` in a worker process without access to the
|
implementation of :meth:`has_book` in a worker process without access to the
|
||||||
db. '''
|
db. '''
|
||||||
|
try:
|
||||||
return {icu_lower(title) for title in self.fields['title'].table.book_col_map.itervalues()}
|
return {icu_lower(title) for title in self.fields['title'].table.book_col_map.itervalues()}
|
||||||
|
except TypeError:
|
||||||
|
# Some non-unicode titles in the db
|
||||||
|
return {icu_lower(as_unicode(title)) for title in self.fields['title'].table.book_col_map.itervalues()}
|
||||||
|
|
||||||
@read_api
|
@read_api
|
||||||
def has_book(self, mi):
|
def has_book(self, mi):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user