When listing the trash dir ignore entries without a useable metadata.opf

This commit is contained in:
Kovid Goyal 2023-04-21 14:44:31 +05:30
parent d7632c256c
commit 67ad60d536
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -2086,9 +2086,12 @@ class DB:
try:
book_id = int(x.name)
mtime = x.stat(follow_symlinks=False).st_mtime
with open(make_long_path_useable(os.path.join(x.path, METADATA_FILE_NAME)), 'rb') as opf_stream:
opf = OPF(opf_stream, basedir=x.path)
except Exception:
import traceback
traceback.print_exc()
continue
opf = OPF(os.path.join(x.path, METADATA_FILE_NAME), basedir=x.path)
books.append(TrashEntry(book_id, opf.title or unknown, (opf.authors or au)[0], os.path.join(x.path, COVER_FILE_NAME), mtime))
base = os.path.join(self.trash_dir, 'f')
um = {'title': unknown, 'authors': au}