From 386885881152f8119d39869c61555fcf939a2ed4 Mon Sep 17 00:00:00 2001 From: pax Date: Sun, 12 Apr 2026 01:10:53 -0500 Subject: [PATCH] media_controller: set _cached_path for streaming videos Streaming videos skip on_image_done (the _load coroutine returns early), so the thumbnail's _cached_path was never set. Drag-to-copy failed until the user navigated away and back (which went through the cached path and hit on_image_done). Now on_video_stream sets _cached_path to the expected cache location immediately. Once the stream-record promotes the .part file on EOF, drag-to-copy works without needing to change posts first. --- booru_viewer/gui/media_controller.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/booru_viewer/gui/media_controller.py b/booru_viewer/gui/media_controller.py index 58ec696..6ae33a6 100644 --- a/booru_viewer/gui/media_controller.py +++ b/booru_viewer/gui/media_controller.py @@ -182,6 +182,14 @@ class MediaController: else: self._app._preview._video_player.stop() self._app._preview.set_media(url, info) + # Set the expected cache path on the thumbnail so drag-to-copy + # works once the stream-record promotes the .part file on EOF. + # Streaming videos skip on_image_done (which normally sets this), + # so without this the thumbnail never gets a _cached_path. + from ..core.cache import cached_path_for + idx = self._app._grid.selected_index + if 0 <= idx < len(self._app._grid._thumbs): + self._app._grid._thumbs[idx]._cached_path = str(cached_path_for(url)) self._app._status.showMessage(f"Streaming #{Path(url.split('?')[0]).name}...") def on_download_progress(self, downloaded: int, total: int) -> None: