fix(services): reorder binary path resolution, mux progress, thumbnails
Supersedes #44, which was closed due to CI formatting failures.
Rebased on current develop, all pre-commit checks passing (biome, tsc, cargo check). Addresses both Codex review findings from #44:
- Muxing label now localized via i18n keys across all 6 locales
- Sidecar placeholder creation gated to debug profile only
Problem
Binary path resolution in ffmpeg.rs, ytdlp.rs, and deno.rs checks hardcoded paths (/opt/homebrew/bin, /usr/local/bin, /usr/bin) before $PATH entries. This causes the app to miss binaries provided by Nix, Homebrew, or other package managers that express their binaries through PATH. On macOS, GUI apps launched from Finder don't inherit the user's shell PATH, making the hardcoded fallbacks essential — but they should be fallbacks, not the primary resolution mechanism.
Expected: The app resolves yt-dlp, ffmpeg, and deno from the user's PATH first, then falls back to well-known locations.
Actual: Hardcoded paths win over PATH entries. A stale or missing binary at /usr/local/bin/ffmpeg shadows a working one in PATH (see #42).
Additionally:
- The yt-dlp sidecar placeholder created by
build.rsfor dev builds (a 22-byte shell stub) is returned as a valid bundled binary byget_bundled_ytdlp_path(), causing silent failures at runtime. deno.rschecks~/.deno/bin/deno(curl installer location) beforewhich deno, so a system-provided deno on PATH is shadowed by a stale home-dir install.- During
--download-sectionsdownloads, yt-dlp delegates the mux/merge to ffmpeg. The progress parser only handles[download] X%lines — ffmpeg stderr progress (time=,speed=,Lsize=) is ignored, leaving the progress bar stuck at 0%. UniversalQueueItemhas no YouTube thumbnail fallback. When metadata fetch fails, the queue shows a blank grey placeholder instead of the readily availableimg.youtube.comthumbnail.- Firefox profile selection returns profiles in file order. The active profile (where cookies live) is often not first, causing
--cookies-from-browser firefox:<profile>to target the wrong profile.
Fix
Binary path resolution (ffmpeg.rs, ytdlp.rs, deno.rs)
- Reorder
get_system_binary_candidates()to iterate$PATHentries first, then append well-known fallback paths with deduplication - Reorder
get_deno_path()andcheck_deno_internal():which/where(PATH) before~/.deno/bin/denofallback
Dev build sidecar (build.rs, ytdlp.rs)
build.rscreates a minimal placeholder sotauri_build::build()passes externalBin validation without a real per-platform binary — gated to debug profile only so release builds fail fast when the CI-provided binary is absentget_bundled_ytdlp_path()rejects files under 1024 bytes as placeholdersget_ytdlp_path()falls through to system PATH as last resort in Auto mode
FFmpeg mux progress (progress.rs, download.rs, types.ts, contexts, queue components)
- Add
parse_ffmpeg_progress()matching ffmpeg stderr lines containingtime=HH:MM:SS,speed=Nx,Lsize= download.rsstderr task emitsdownload-progresswithstatus="muxing"whenparse_progress()returns None andparse_ffmpeg_progress()matches- Add
isMuxingfield toDownloadItem— set inDownloadContext.tsxandUniversalContext.tsxwithout overridingisLive QueueItem.tsxandUniversalQueueItem.tsxrender an indeterminate shimmer bar with localized muxing label, elapsed time, and speed whenisMuxing && progress === 0
YouTube thumbnail fallback (UniversalQueueItem.tsx)
- Add
getYouTubeVideoId()at module level extracting video ID from YouTube URLs thumbnailUrlfalls back toimg.youtube.com/vi/{id}/mqdefault.jpgwhenitem.thumbnailis null or erroreduseEffectresetsthumbErroronitem.thumbnailchange to prevent stale error state
Firefox profile sorting (dependencies.rs)
- Add
parse_firefox_profiles()parsingprofiles.ini[Install*]sectionDefault=to identify the active profile path - Sort profiles with active profile first, then alphabetical
- Replaces inline
Name=line scanning on all three platforms (macOS, Windows, Linux)
i18n (all 6 locales × 2 namespaces)
- Add
queue.status.muxingtranslation key todownload.jsonanduniversal.jsonfor en, vi, zh-CN, fr, pt, ru
Test plan
- [ ] yt-dlp, ffmpeg, deno resolve from PATH in Nix devshell
- [ ] Dev build compiles without real yt-dlp sidecar binary
- [ ] Release build without sidecar fails at
tauri_build::build() - [ ] Download video with
--download-sections— muxing shimmer bar displays with elapsed time and speed - [ ] Paste YouTube URL in Universal queue — thumbnail fallback renders from
img.youtube.com - [ ] Firefox cookie profile shows active profile first
Fixes #42
Thank you for reporting the bug. Honestly, very few people encounter this issue, and you modified quite a few files. I couldn't monitor everything and didn't have enough time to test all environments, so I've made the minimum possible fixes in the latest commits.
Thank you again very much.