feat: download thumbnail preview (v0.2.0) + fix playlist/time-range CI failures - #1
Merged
Merged
Conversation
- New download_preview Tauri command (preview.rs): fetches a thumbnail URL to bytes and saves it under the video's title (sanitized) in the same download directory used for videos. - YouTube: tries maxresdefault.jpg, falls back to hqdefault.jpg on 404. - Twitch: downloads the single thumbnail_url as-is (no alternate resolution available). - "Save preview" button added next to both the YouTube and Twitch preview thumbnails; shows a "Preview saved" notification matching the existing video-download result box. fix: is_playlist_url and validate_time_range edge cases - is_playlist_url: a bare youtube.com/playlist with no list= param is no longer misclassified as a playlist; twitch.tv/videos/<id> (a single VOD link) is no longer misclassified as a channel's videos listing. - validate_time_range: start exceeding the video's duration is now rejected even when end defaults to "00:00:00" (play to the end). Bump version 0.1.0 -> 0.2.0 (new user-facing feature, no breaking changes).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Feature: download preview
Adds a "Save preview" button next to the YouTube and Twitch thumbnail previews. Downloads the thumbnail image to disk into the same folder used for video downloads, named after the video title (sanitized).
download_preview(src-tauri/src/functions/preview.rs), registered inlib.rs.maxresdefault.jpgwith fallback tohqdefault.jpgon 404 (no maxres available for older/low-quality videos).thumbnail_urlyt-dlp reports, as-is — no alternate-resolution URL exists to fall back to.sanitize_filename, unit-tested) +.jpg; overwrites silently if it already exists, matching existing download behavior.previewDownloading/previewResultstate,handleDownloadPreviewhandler, "Preview saved" result box mirroring the existing video-download result box.Fix: CI test failures
Two pre-existing bugs caught by tests already in
integration_tests.rs(marked// BUG:):is_playlist_url:youtube.com/playlistwith nolist=param was misclassified as a playlist;twitch.tv/videos/<id>(single VOD link) was misclassified as a channel's videos listing via a naive.contains("/videos")check. Now parses path segments instead.validate_time_range:startexceeding the video's duration passed validation whenenddefaulted to"00:00:00"(play-to-end). Now validatesstartagainstmax_durationin that case too.Version bump
0.1.0→0.2.0(package.json, tauri.conf.json, Cargo.toml/Cargo.lock) — new user-facing feature, no breaking changes.Verification
cargo test --verbose: 40/40 passing (8 unit incl. 5 newsanitize_filenametests, 32 integration incl. the 3 previously-failing tests).cargo check: clean.bunx tsc --noEmit: clean.tauri devbuild (webkit2gtk) compiles and launches without runtime errors.maxresdefault404s for videos without a maxres thumbnail, confirming the fallback path is necessary and correct.