mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
py3: Fix #1850571 [[Python3] kobo driver fails to load](https://bugs.launchpad.net/calibre/+bug/1850571)
This commit is contained in:
parent
55033c352d
commit
21afbdc1d6
@ -408,7 +408,7 @@ class KOBO(USBMS):
|
|||||||
# Remove books that are no longer in the filesystem. Cache contains
|
# Remove books that are no longer in the filesystem. Cache contains
|
||||||
# indices into the booklist if book not in filesystem, None otherwise
|
# indices into the booklist if book not in filesystem, None otherwise
|
||||||
# Do the operation in reverse order so indices remain valid
|
# Do the operation in reverse order so indices remain valid
|
||||||
for idx in sorted(itervalues(bl_cache), reverse=True):
|
for idx in sorted(itervalues(bl_cache), reverse=True, key=lambda x: x or -1):
|
||||||
if idx is not None:
|
if idx is not None:
|
||||||
need_sync = True
|
need_sync = True
|
||||||
del bl[idx]
|
del bl[idx]
|
||||||
@ -1971,7 +1971,7 @@ class KOBOTOUCH(KOBO):
|
|||||||
# Remove books that are no longer in the filesystem. Cache contains
|
# Remove books that are no longer in the filesystem. Cache contains
|
||||||
# indices into the booklist if book not in filesystem, None otherwise
|
# indices into the booklist if book not in filesystem, None otherwise
|
||||||
# Do the operation in reverse order so indices remain valid
|
# Do the operation in reverse order so indices remain valid
|
||||||
for idx in sorted(itervalues(bl_cache), reverse=True):
|
for idx in sorted(itervalues(bl_cache), reverse=True, key=lambda x: x or -1):
|
||||||
if idx is not None:
|
if idx is not None:
|
||||||
if not os.path.exists(self.normalize_path(os.path.join(prefix, bl[idx].lpath))) or not bl[idx].contentID:
|
if not os.path.exists(self.normalize_path(os.path.join(prefix, bl[idx].lpath))) or not bl[idx].contentID:
|
||||||
need_sync = True
|
need_sync = True
|
||||||
|
Loading…
x
Reference in New Issue
Block a user