Unverified 提交 a99feb55 authored 作者: Copilot's avatar Copilot 提交者: GitHub

Fix issue #1554: Preserve custom thumbnails in gallery script (#1649)

* Initial plan * Fix issue #1554: Preserve custom thumbnails in gallery script Modified scripts/generate_gallery.py to check if a thumbnail file already exists before extracting from notebooks. This prevents the script from overwriting manually-placed custom thumbnails in the _thumbnails directory. The gen_previews() method now: 1. Checks if self.png_path exists 2. If yes, logs info message and returns early (preserving custom thumbnail) 3. If no, proceeds with extraction from notebook or uses default logo Fixes #1554 --------- Co-authored-by: 's avatarcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
上级 db5178ba
......@@ -118,6 +118,13 @@ class NotebookGenerator:
return None
def gen_previews(self):
if self.png_path.exists():
logger.info(
f"Custom thumbnail already exists for {self.basename}, skipping extraction",
type="thumbnail_extractor",
)
return
preview = self.extract_preview_pic()
if preview is not None:
with self.png_path.open("wb") as buff:
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论