Skip to content

Commit d99a3d3

Browse files
Merge pull request #750 from tomried/main
fix: apply metadata to file even when no cover.jpg is present
2 parents 518b05c + 3f1eba8 commit d99a3d3

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

scripts/cover_enforcer.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -422,7 +422,10 @@ def enforce_cover(self, book_dir: str) -> list:
422422
for file in supported_files:
423423
book = Book(book_dir, file)
424424
self.replace_old_metadata(book.old_metadata_path, book.new_metadata_path)
425-
os.system(f'ebook-polish -c "{book.cover_path}" -o "{book.new_metadata_path}" -U "{file}" "{file}"')
425+
if Path(book.cover_path).exists():
426+
os.system(f'ebook-polish -c "{book.cover_path}" -o "{book.new_metadata_path}" -U "{file}" "{file}"')
427+
else:
428+
os.system(f'ebook-polish -o "{book.new_metadata_path}" -U "{file}" "{file}"')
426429
self.empty_metadata_temp()
427430
print(f"[cover-metadata-enforcer]: DONE: '{book.title_author}.{book.file_format}': Cover & Metadata updated", flush=True)
428431
book_objects.append(book)

0 commit comments

Comments
 (0)