From 744af7337ba7a195b02b4f5e4b027dcbde9e3b51 Mon Sep 17 00:00:00 2001 From: Mattias Tall Date: Tue, 26 May 2026 17:37:03 +0200 Subject: [PATCH] Add quality indicator and re-download at quality to Watch page MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Quality selector now always visible when idle (not just pre-download) - Saved chip shows actual downloaded resolution (e.g. "Saved · 1080p") - Re-download chip deletes existing file and starts new download at selected quality Co-Authored-By: Claude Sonnet 4.6 --- frontend/src/pages/Watch.jsx | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/frontend/src/pages/Watch.jsx b/frontend/src/pages/Watch.jsx index 072bf09..300ba07 100644 --- a/frontend/src/pages/Watch.jsx +++ b/frontend/src/pages/Watch.jsx @@ -562,6 +562,7 @@ export default function Watch() { const [queued, setQueued] = useState(null); const [liked, setLiked] = useState(null); const [disliked, setDisliked] = useState(null); + const [isRedownloading, setIsRedownloading] = useState(false); const [selectedQuality, setSelectedQuality] = useState(null); const [speed, setSpeed] = useState(1); const [autoplay, setAutoplay] = useState(false); @@ -721,6 +722,22 @@ export default function Watch() { setPlayRequested(true); downloadMut.mutate(); }, [downloadMut]); + const handleRedownload = useCallback(async () => { + const dlId = downloadId ?? allDownloads.find( + d => d.youtube_video_id === youtubeVideoId && d.status === "complete" + )?.id; + if (!dlId) return; + setIsRedownloading(true); + try { await deleteDownload(dlId); } catch (_) {} + setFileReady(false); + setConfirmedFileUrl(null); + setDownloadId(null); + setPlayRequested(false); + setIsRedownloading(false); + qc.invalidateQueries({ queryKey: ["downloads"] }); + refetchVideo(); + downloadMut.mutate(); + }, [downloadId, allDownloads, youtubeVideoId, downloadMut, refetchVideo, qc]); const saveProgress = useCallback((secs) => { if (!video?.id) return; @@ -792,6 +809,7 @@ export default function Watch() { const isLiked = liked ?? video?.liked ?? false; const isDisliked = disliked ?? (video?.rating === -1) ?? false; const dlComplete = dlStatus?.status === "complete" || video?.is_downloaded; + const downloadedResolution = dlStatus?.resolution ?? video?.download_resolution; const isFollowed = followMut.isSuccess || video?.channel_followed; const subs = formatSubs(channel?.subscriber_count); @@ -912,7 +930,7 @@ export default function Watch() { {/* Actions */}
- {!dlComplete && !isDownloading && !downloadMut.isPending && ( + {!isDownloading && !downloadMut.isPending && !isRedownloading && (