Skip to content

feat: download thumbnail preview (v0.2.0) + fix playlist/time-range CI failures - #1

Merged
AxalotLDev merged 1 commit into
mainfrom
feature/youtube-preview-download
Aug 19, 2026
Merged

feat: download thumbnail preview (v0.2.0) + fix playlist/time-range CI failures#1
AxalotLDev merged 1 commit into
mainfrom
feature/youtube-preview-download

Conversation

@AxalotLDev

Copy link
Copy Markdown
Owner

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).

  • New Rust command download_preview (src-tauri/src/functions/preview.rs), registered in lib.rs.
  • YouTube: maxresdefault.jpg with fallback to hqdefault.jpg on 404 (no maxres available for older/low-quality videos).
  • Twitch: downloads the single thumbnail_url yt-dlp reports, as-is — no alternate-resolution URL exists to fall back to.
  • Filename: sanitized video title (sanitize_filename, unit-tested) + .jpg; overwrites silently if it already exists, matching existing download behavior.
  • Frontend: previewDownloading / previewResult state, handleDownloadPreview handler, "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/playlist with no list= 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: start exceeding the video's duration passed validation when end defaulted to "00:00:00" (play-to-end). Now validates start against max_duration in that case too.

Version bump

0.1.00.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 new sanitize_filename tests, 32 integration incl. the 3 previously-failing tests).
  • cargo check: clean.
  • bunx tsc --noEmit: clean.
  • Full tauri dev build (webkit2gtk) compiles and launches without runtime errors.
  • Verified real YouTube CDN behavior via curl: maxresdefault 404s for videos without a maxres thumbnail, confirming the fallback path is necessary and correct.

- 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).
@AxalotLDev
AxalotLDev merged commit f52043c into main Aug 19, 2026
1 check passed
@AxalotLDev
AxalotLDev deleted the feature/youtube-preview-download branch August 19, 2026 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant