mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 01:52:31 +02:00
Do not add books to the list of books on device if they are already in the list. Fixes book showing up multiple times if it it sent to the device multiple times. Only one istance of the book will be on the device in this case.
This commit is contained in:
parent
02e4e537e4
commit
d0986bbe8a
2 changed files with 8 additions and 2 deletions
|
|
@ -18,6 +18,9 @@ def __init__(self, path, title, authors, mime):
|
|||
self.thumbnail = None
|
||||
self.tags = []
|
||||
|
||||
def __eq__(self, other):
|
||||
return self.path == other.path
|
||||
|
||||
@apply
|
||||
def title_sorter():
|
||||
doc = '''String to sort the title. If absent, title is returned'''
|
||||
|
|
|
|||
|
|
@ -109,7 +109,7 @@ def get_size(obj):
|
|||
if not os.path.exists(newpath):
|
||||
os.makedirs(newpath)
|
||||
|
||||
filepath = os.path.join(newpath, names.next())
|
||||
filepath = os.path.join(newpath, names.next())
|
||||
paths.append(filepath)
|
||||
|
||||
if hasattr(infile, 'read'):
|
||||
|
|
@ -132,7 +132,10 @@ def add_books_to_metadata(cls, locations, metadata, booklists):
|
|||
on_card = 1 if location[1] else 0
|
||||
|
||||
title, author, mime = cls.extract_book_metadata_by_filename(os.path.basename(path))
|
||||
booklists[on_card].append(Book(path, title, author, mime))
|
||||
book = Book(path, title, author, mime)
|
||||
|
||||
if not book in booklists[on_card]:
|
||||
booklists[on_card].append(book)
|
||||
|
||||
def delete_books(self, paths, end_session=True):
|
||||
for path in paths:
|
||||
|
|
|
|||
Loading…
Reference in a new issue