mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04: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
@ -18,6 +18,9 @@ class Book(object):
|
||||
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 @@ class USBMS(Device):
|
||||
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 @@ class USBMS(Device):
|
||||
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…
x
Reference in New Issue
Block a user