From ea089075e6d4cb15af3e23d5f3f79e605c458430 Mon Sep 17 00:00:00 2001 From: pax Date: Sun, 5 Apr 2026 16:28:53 -0500 Subject: [PATCH] Copy browse thumbnail to library cache on save When saving a post to library, copies the booru preview thumbnail to thumbnails/library/ so the Library tab shows it instantly without needing to regenerate. --- booru_viewer/gui/app.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/booru_viewer/gui/app.py b/booru_viewer/gui/app.py index 14c56f9..9d56efc 100644 --- a/booru_viewer/gui/app.py +++ b/booru_viewer/gui/app.py @@ -1768,6 +1768,19 @@ class BooruApp(QMainWindow): import shutil shutil.copy2(path, dest) + # Copy browse thumbnail to library thumbnail cache + if post.preview_url: + from ..core.config import thumbnails_dir + from ..core.cache import cached_path_for as _cpf + thumb_src = _cpf(post.preview_url, thumbnails_dir()) + if thumb_src.exists(): + lib_thumb_dir = thumbnails_dir() / "library" + lib_thumb_dir.mkdir(parents=True, exist_ok=True) + lib_thumb = lib_thumb_dir / f"{post.id}.jpg" + if not lib_thumb.exists(): + import shutil as _sh + _sh.copy2(thumb_src, lib_thumb) + where = folder or "Unsorted" self._signals.bookmark_done.emit( self._grid.selected_index,