mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Fix the booklist delete algorithm
This commit is contained in:
parent
7fa63195bd
commit
e4b0f51363
@ -85,10 +85,10 @@ class USBMS(CLI, Device):
|
||||
lpath = lpath.replace('\\', '/')
|
||||
idx = bl_cache.get(lpath, None)
|
||||
if idx is not None:
|
||||
bl_cache[lpath] = None
|
||||
if self.update_metadata_item(bl[idx]):
|
||||
#print 'update_metadata_item returned true'
|
||||
changed = True
|
||||
bl_cache[lpath] = None
|
||||
else:
|
||||
#print "adding new book", lpath
|
||||
if bl.add_book(self.book_from_path(prefix, lpath),
|
||||
@ -130,7 +130,7 @@ class USBMS(CLI, Device):
|
||||
# Remove books that are no longer in the filesystem. Cache contains
|
||||
# indices into the booklist if book not in filesystem, None otherwise
|
||||
# Do the operation in reverse order so indices remain valid
|
||||
for idx in bl_cache.itervalues().reversed():
|
||||
for idx in sorted(bl_cache.itervalues(), reverse=True):
|
||||
if idx is not None:
|
||||
need_sync = True
|
||||
del bl[idx]
|
||||
|
Loading…
x
Reference in New Issue
Block a user