Performance improvement again: don't change an existing method's signature.

This commit is contained in:
Charles Haley 2014-09-09 14:09:51 +02:00
parent 829447f01f
commit c0b4994b6e
2 changed files with 6 additions and 3 deletions

View File

@ -1260,7 +1260,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
if book: if book:
if self.client_cache_uses_lpaths: if self.client_cache_uses_lpaths:
lpaths_on_device.add(r.get('lpath')) lpaths_on_device.add(r.get('lpath'))
bl.add_book(book, replace_metadata=True, bl.add_book_extended(book, replace_metadata=True,
check_for_duplicates=not self.client_cache_uses_lpaths) check_for_duplicates=not self.client_cache_uses_lpaths)
book.set('_is_read_', r.get('_is_read_', None)) book.set('_is_read_', r.get('_is_read_', None))
book.set('_sync_type_', r.get('_sync_type_', None)) book.set('_sync_type_', r.get('_sync_type_', None))
@ -1307,7 +1307,7 @@ class SMART_DEVICE_APP(DeviceConfig, DevicePlugin):
book.set('_is_read_', result.get('_is_read_', None)) book.set('_is_read_', result.get('_is_read_', None))
book.set('_sync_type_', result.get('_sync_type_', None)) book.set('_sync_type_', result.get('_sync_type_', None))
book.set('_last_read_date_', result.get('_last_read_date_', None)) book.set('_last_read_date_', result.get('_last_read_date_', None))
bl.add_book(book, replace_metadata=True, bl.add_book_extended(book, replace_metadata=True,
check_for_duplicates=not self.client_cache_uses_lpaths) check_for_duplicates=not self.client_cache_uses_lpaths)
if '_new_book_' in result: if '_new_book_' in result:
book.set('_new_book_', True) book.set('_new_book_', True)

View File

@ -72,7 +72,10 @@ class BookList(_BookList):
def supports_collections(self): def supports_collections(self):
return False return False
def add_book(self, book, replace_metadata, check_for_duplicates=True): def add_book(self, book, replace_metadata):
self.add_book_extended(book, replace_metadata, check_for_duplicates=True)
def add_book_extended(self, book, replace_metadata, check_for_duplicates):
''' '''
Add the book to the booklist, if needed. Return None if the book is Add the book to the booklist, if needed. Return None if the book is
already there and not updated, otherwise return the book. already there and not updated, otherwise return the book.