This commit is contained in:
Kovid Goyal 2024-07-06 12:59:35 +05:30
parent 2bb2573ff8
commit c9ce5883c7
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -18,7 +18,6 @@ from calibre import force_unicode, human_readable, prints
from calibre.ebooks import BOOK_EXTENSIONS from calibre.ebooks import BOOK_EXTENSIONS
from calibre.utils.date import as_utc, local_tz from calibre.utils.date import as_utc, local_tz
from calibre.utils.icu import lower, sort_key from calibre.utils.icu import lower, sort_key
from polyglot.builtins import itervalues
bexts = frozenset(BOOK_EXTENSIONS) - {'mbp', 'tan', 'rar', 'zip', 'xml'} bexts = frozenset(BOOK_EXTENSIONS) - {'mbp', 'tan', 'rar', 'zip', 'xml'}
@ -228,7 +227,7 @@ class FilesystemCache:
for entry in entries: for entry in entries:
FileOrFolder(entry, self) FileOrFolder(entry, self)
for item in itervalues(self.id_map): for item in self.id_map.values():
try: try:
p = item.parent p = item.parent
except KeyError: except KeyError:
@ -254,7 +253,7 @@ class FilesystemCache:
return e return e
def iterebooks(self, storage_id): def iterebooks(self, storage_id):
for x in itervalues(self.id_map): for x in self.id_map.values():
if x.storage_id == storage_id and x.is_ebook: if x.storage_id == storage_id and x.is_ebook:
if x.parent_id == storage_id and x.name.lower().endswith('.txt'): if x.parent_id == storage_id and x.name.lower().endswith('.txt'):
continue # Ignore .txt files in the root continue # Ignore .txt files in the root