56 lines
3.4 KiB
Markdown
56 lines
3.4 KiB
Markdown
|
|
# Fix Post-v0.1.2 Issues
|
||
|
|
|
||
|
|
**Date:** 2026-09-22 15:48
|
||
|
|
**Task:** Fix broken keyframe detection, missing cached captions, and About dialog version duplication
|
||
|
|
|
||
|
|
## Changes Made
|
||
|
|
|
||
|
|
### Issue 1: Keyframe buttons always greyed out
|
||
|
|
|
||
|
|
**Root cause:** ffprobe 8.x no longer populates the `flags` field. The parser in `keyframe_index.rs` expected 3-column CSV output (`media_type,pts_time,flags`) and checked `parts[2].contains('K')`. With ffprobe 8.0.1, the output was just timestamps (flags absent), so the parser's `parts.len() >= 3` check failed on every line, always returning `[]`.
|
||
|
|
|
||
|
|
Confirmed locally: `ffprobe -show_entries frame=pts_time,flags -of csv=p=0 -skip_frame nokey` produces:
|
||
|
|
```
|
||
|
|
0.000000,
|
||
|
|
1.000000
|
||
|
|
```
|
||
|
|
|
||
|
|
**Fix in `src-tauri/src/services/keyframe_index.rs`:**
|
||
|
|
- Changed ffprobe command to only request `frame=pts_time` (dropped `flags` since `-skip_frame nokey` already filters to keyframes)
|
||
|
|
- Rewrote `parse_ffprobe_output` to handle: (a) new format: plain timestamp per line with optional trailing comma, (b) legacy format: `section,pts_time[,flags]`
|
||
|
|
- Updated all tests — 5 tests covering new format, legacy with flags, legacy with section prefix, empty, and whitespace
|
||
|
|
|
||
|
|
### Issue 2: Captions not cached or loaded from cache
|
||
|
|
|
||
|
|
**Root cause:** In `save_analysis_to_cache` (cache.rs), caption paths were relativized via `strip_prefix(&cache_dir)`. But captions live outside the cache dir (e.g. `/tmp/video-clipper/subtitles/embedded.vtt`), so `strip_prefix` always failed and `relative_caption` was `None`. Captions were never saved to the manifest.
|
||
|
|
|
||
|
|
**Fix (2 files):**
|
||
|
|
1. `src-tauri/src/commands/cache.rs`: When `strip_prefix` fails, copy the caption file into `cache_dir/captions/` and store the relative path.
|
||
|
|
2. `src/lib/stores/videoSession.svelte.ts`: In the cache-hit path of `triggerPostDownloadProcessing`, if `captionFilePath` is null (old caches without captions), fall back to `loadCaptionsWithCache(filePath)` for re-extraction.
|
||
|
|
|
||
|
|
### Issue 3: About dialog shows "v0.1.2 (0.1.2)"
|
||
|
|
|
||
|
|
**Root cause:** The native macOS About dialog shows "Version {CFBundleShortVersionString} ({CFBundleVersion})". Tauri sets both from the same `version` field, producing "Version 0.1.2 (0.1.2)".
|
||
|
|
|
||
|
|
**Fix in `src-tauri/src/lib.rs`:** Created a custom macOS app menu with `AboutMetadataBuilder` that only sets `short_version` (no build number). Also provides standard Edit menu (undo/redo/cut/copy/paste/select-all). Version is read at compile time via `env!("CARGO_PKG_VERSION")`.
|
||
|
|
|
||
|
|
## Files Changed
|
||
|
|
|
||
|
|
- `src-tauri/src/services/keyframe_index.rs` — Fix 1: ffprobe command + parser + tests
|
||
|
|
- `src-tauri/src/commands/cache.rs` — Fix 2: copy captions into cache dir
|
||
|
|
- `src/lib/stores/videoSession.svelte.ts` — Fix 2: caption fallback on cache hit
|
||
|
|
- `src-tauri/src/lib.rs` — Fix 3: custom macOS menu
|
||
|
|
|
||
|
|
## Verification
|
||
|
|
|
||
|
|
- `cargo check`: 0 warnings, 0 errors
|
||
|
|
- `cargo test`: 58 passed, 0 failed
|
||
|
|
- `svelte-check`: 0 errors, 0 warnings
|
||
|
|
- `ReadLints`: no issues
|
||
|
|
|
||
|
|
## Lessons Learned
|
||
|
|
|
||
|
|
1. ffprobe output format can change across major versions. The `flags` field was silently dropped in ffprobe 8.x. Always test against the actual binary on the target system.
|
||
|
|
2. When caching file references, files outside the cache directory need to be copied in — `strip_prefix` silently returns `None` on failure via `.ok()`, making the bug invisible.
|
||
|
|
3. Native macOS About dialogs auto-format version info as "Version X (Build Y)". When both values are identical, it looks like a bug. Use `AboutMetadataBuilder` to control this.
|