mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Speed up adding books to an already large collection
This commit is contained in:
parent
ec8431579d
commit
56b9ceed10
@ -622,7 +622,11 @@ class LibraryDatabase2(LibraryDatabase):
|
|||||||
if title:
|
if title:
|
||||||
if not isinstance(title, unicode):
|
if not isinstance(title, unicode):
|
||||||
title = title.decode(preferred_encoding, 'replace')
|
title = title.decode(preferred_encoding, 'replace')
|
||||||
return bool(self.conn.get('SELECT id FROM books where title=?', (title,), all=False))
|
tf = FIELD_MAP['title']
|
||||||
|
q = title.lower()
|
||||||
|
for record in self.data._data:
|
||||||
|
if record is not None and record[tf].lower() == q:
|
||||||
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
def has_cover(self, index, index_is_id=False):
|
def has_cover(self, index, index_is_id=False):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user