mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-08-11 09:13:57 -04:00
Fix #1603 (traceback on adding multiple books from directories, each directory single book with multiple versions)
This commit is contained in:
parent
7af0e4b7fc
commit
4dc946d79b
@ -1551,9 +1551,6 @@ ALTER TABLE books ADD COLUMN isbn TEXT DEFAULT "" COLLATE NOCASE;
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
def has_book(self, mi):
|
|
||||||
return bool(self.conn.get('SELECT id FROM books where title=?', (mi.title,), all=False))
|
|
||||||
|
|
||||||
def has_id(self, id):
|
def has_id(self, id):
|
||||||
return self.conn.get('SELECT id FROM books where id=?', (id,), all=False) is not None
|
return self.conn.get('SELECT id FROM books where id=?', (id,), all=False) is not None
|
||||||
|
|
||||||
|
@ -562,6 +562,14 @@ class LibraryDatabase2(LibraryDatabase):
|
|||||||
return img
|
return img
|
||||||
return f if as_file else f.read()
|
return f if as_file else f.read()
|
||||||
|
|
||||||
|
def has_book(self, mi):
|
||||||
|
title = mi.title
|
||||||
|
if title:
|
||||||
|
if not isinstance(title, unicode):
|
||||||
|
title = title.decode(preferred_encoding, 'replace')
|
||||||
|
return bool(self.conn.get('SELECT id FROM books where title=?', (title,), all=False))
|
||||||
|
return False
|
||||||
|
|
||||||
def has_cover(self, index, index_is_id=False):
|
def has_cover(self, index, index_is_id=False):
|
||||||
id = index if index_is_id else self.id(index)
|
id = index if index_is_id else self.id(index)
|
||||||
path = os.path.join(self.library_path, self.path(id, index_is_id=True), 'cover.jpg')
|
path = os.path.join(self.library_path, self.path(id, index_is_id=True), 'cover.jpg')
|
||||||
|
Loading…
x
Reference in New Issue
Block a user