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.
This commit is contained in:
pax 2026-04-12 01:10:53 -05:00
parent 7ef517235f
commit 3868858811

View File

@ -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: