fix(subsync): harden manual requests, error output, and track reload

- validate reference files (absolute regular file, size cap) before reading
- redact stream tokens and truncate tool output in failure messages
- keep title and lang when re-adding the synced track
- ignore an external audio track's ff-index when mapping the video's audio
- report discarded stale auto results, bound manual offsets, yield between alignments
- update stale subsync docs, fix markdown formatting, discover subtitle tests by lane
This commit is contained in:
sudacode committed 2026-11-28 03:15:35 -08:00
1 parent a303d6be27
commit 24b25287bd
15 files changed
+306 -84

No files matched your search

+7 -7
View File
@@ -525,13 +525,13 @@ Built-in alass-based subtitle alignment works out of the box with no extra sync
Optional external [`alass`](https://github.com/kaegi/alass) and [`ffsubsync`](https://github.com/smacke/ffsubsync) binaries are also supported in the guided modal when installed.
| Key | Default | What it does |
| ------------------------ | -------- | ----------------------------------------------------------------------------------------------------------------- |
| `subsync.mode` | `"auto"` | `"auto"` syncs immediately and opens the guided modal only when needed; `"manual"` always opens the modal |
| `subsync.alass_path` | `""` | Optional external `alass` path. Empty auto-discovers from `PATH` |
| `subsync.ffsubsync_path` | `""` | Optional external `ffsubsync` path. Empty auto-discovers from `PATH` |
| `subsync.ffmpeg_path` | `""` | `ffmpeg` path used to extract embedded tracks and audio speech. Empty auto-discovers from `PATH` |
| `subsync.replace` | `true` | Overwrite the subtitle file. When off, write `<name>_retimed.<ext>` |
| Key | Default | What it does |
| ------------------------ | -------- | --------------------------------------------------------------------------------------------------------- |
| `subsync.mode` | `"auto"` | `"auto"` syncs immediately and opens the guided modal only when needed; `"manual"` always opens the modal |
| `subsync.alass_path` | `""` | Optional external `alass` path. Empty auto-discovers from `PATH` |
| `subsync.ffsubsync_path` | `""` | Optional external `ffsubsync` path. Empty auto-discovers from `PATH` |
| `subsync.ffmpeg_path` | `""` | `ffmpeg` path used to extract embedded tracks and audio speech. Empty auto-discovers from `PATH` |
| `subsync.replace` | `true` | Overwrite the subtitle file. When off, write `<name>_retimed.<ext>` |
### AniList
+2 -2
View File
@@ -2,7 +2,7 @@
Short recordings from real playback sessions.
_Yomitan_ is the pop-up dictionary. _Jimaku_ is a community subtitle database. _alass_ and _ffsubsync_ retime subtitles against the audio. _Jellyfin_ is a self-hosted media server. A _texthooker_ is a web page that mirrors the current subtitle as selectable text.
_Yomitan_ is the pop-up dictionary. _Jimaku_ is a community subtitle database. _alass_ is the subtitle aligner SubMiner's built-in sync is based on. _Jellyfin_ is a self-hosted media server. A _texthooker_ is a web page that mirrors the current subtitle as selectable text.
<script setup>
import { withBase } from 'vitepress';
@@ -24,7 +24,7 @@ Mine a card from Yomitan or straight from a subtitle line. SubMiner attaches the
## Subtitle download and sync
Search Jimaku, download a track, then retime it with alass or ffsubsync without leaving SubMiner.
Search Jimaku, download a track, then sync it in one click without leaving SubMiner.
<!-- <video controls playsinline preload="metadata" :poster="withBase(`/assets/demos/subtitle-sync-poster.jpg?v=${v}`)">
<source :src="withBase(`/assets/demos/subtitle-sync.webm?v=${v}`)" type="video/webm" />
+1 -1
View File
@@ -85,7 +85,7 @@ For smaller changes, start with the cheapest lane that covers what you touched:
| `bun run test:stats` | Stats dashboard UI under `stats/src/**` |
| `bun run test:runtime:compat` | Compiled-runtime smoke against `dist/` (run `bun run build` first) |
| `bun run test:immersion:sqlite` | Compiles, then runs the SQLite-backed immersion tracker tests |
| `bun run test:subtitle` | alass/ffsubsync subtitle sync |
| `bun run test:subtitle` | Subtitle sync (`src/subsync/**` and the subsync service) |
| `bun run test:docs:kb` | Internal docs, `AGENTS.md`, and repo skills |
Lane membership is defined in `scripts/test-lanes.ts` and discovered by directory, so a new test file joins its lane automatically. Do not hand-list test files in `package.json`. `scripts/run-test-lane.mjs` runs each file in its own `bun test` process, so a hanging test cannot take down the rest of the lane. Pass `--jobs N` to parallelize or `--single-process` to share one process while debugging.
+11 -11
View File
@@ -14,18 +14,18 @@ Getting started takes three steps:
Only mpv is required. Install ffmpeg too unless you are fine with cards that have no audio or screenshot. If you skip it, first-run setup can download a copy for SubMiner.
| Dependency | Needed for | Platforms |
| ------------------------ | -------------------------------------------------------------------------------------------------------------------- | ------------ |
| mpv | Required. The player SubMiner draws over. | All |
| fuse2 | Required to run the AppImage. | Linux |
| Dependency | Needed for | Platforms |
| ------------------------ | ----------------------------------------------------------------------------------------------------------------------------------- | ------------ |
| mpv | Required. The player SubMiner draws over. | All |
| fuse2 | Required to run the AppImage. | Linux |
| ffmpeg | Recommended. Audio clips and screenshots on cards, plus embedded subtitle extraction and built-in audio subtitle sync/verification. | All |
| MeCab + mecab-ipadic | Recommended. More accurate N+1, JLPT, and frequency highlighting. | All |
| yt-dlp | YouTube playback. | All |
| xz | [TsukiHime](/tsukihime-integration) subtitle downloads. Most Linux distros already have it. | All |
| guessit | Better title, season, and episode detection for [AniSkip](/aniskip-integration) and [AniList](/anilist-integration). | All |
| alass or ffsubsync | Optional external subtitle sync engines. SubMiner includes built-in alass-based syncing and speech detection. | All |
| fzf, rofi | The file pickers in the `subminer` command (rofi is Linux only). | Linux, macOS |
| chafa, ffmpegthumbnailer | Thumbnail previews in the pickers. | Linux, macOS |
| MeCab + mecab-ipadic | Recommended. More accurate N+1, JLPT, and frequency highlighting. | All |
| yt-dlp | YouTube playback. | All |
| xz | [TsukiHime](/tsukihime-integration) subtitle downloads. Most Linux distros already have it. | All |
| guessit | Better title, season, and episode detection for [AniSkip](/aniskip-integration) and [AniList](/anilist-integration). | All |
| alass or ffsubsync | Optional external subtitle sync engines. SubMiner includes built-in alass-based syncing and speech detection. | All |
| fzf, rofi | The file pickers in the `subminer` command (rofi is Linux only). | Linux, macOS |
| chafa, ffmpegthumbnailer | Thumbnail previews in the pickers. | Linux, macOS |
To generate Japanese subtitles from audio, you also need whisper.cpp. See [Subtitle generation](/subtitle-generation).
+3 -6
View File
@@ -67,14 +67,11 @@ With a gamepad and keyboard-only mode on, you can mine without a mouse: move acr
## Fix subtitle timing (subsync)
If the subtitles are out of sync, press `Ctrl+Alt+S` to open the subsync dialog. It uses [alass](https://github.com/kaegi/alass) or [ffsubsync](https://github.com/smacke/ffsubsync), which you install separately.
If the subtitles are out of sync, press `Ctrl+Alt+S` or click **Sync** in the [subtitle sidebar](/subtitle-sidebar). SubMiner picks the best-aligned reference (another subtitle track, a sidecar file, or speech in the video's audio), retimes the active subtitle with its built-in aligner, and loads the result back into the same slot. No external tool is needed.
1. Pick the engine.
2. For alass, pick a reference: a subtitle track with correct timing (the secondary track by default) or the video file.
3. Pick the track to retime (the active primary track by default).
4. Run it. SubMiner loads the retimed subtitle back into the same slot.
When it cannot sync confidently, it opens the guided sync modal instead (`Shift+click` **Sync** opens it directly, and `subsync.mode: "manual"` always opens it). There you can pick another reference, browse for a subtitle file, try external [alass](https://github.com/kaegi/alass) or [ffsubsync](https://github.com/smacke/ffsubsync) if installed, or apply a manual offset.
For remote streams such as Jellyfin, only alass with a subtitle reference is available, because ffsubsync and the video reference need the local file. If the tools are not found, see [Troubleshooting](/troubleshooting#subtitle-sync-subsync).
Audio-based sync and ffsubsync need a local video file, so remote streams such as Jellyfin can only sync against a subtitle reference. See [Troubleshooting](/troubleshooting#subtitle-sync-subsync) if a sync keeps falling back to the modal.
## Texthooker
+17 -17
View File
@@ -70,24 +70,24 @@ Built into the overlay, not configurable:
## Overlay features
| Shortcut | Action | Config key |
| ------------------ | ------------------------------------------------------ | ------------------------------------------ |
| `Ctrl/Cmd+Shift+V` | Cycle secondary subtitle bar: hidden, visible, hover | `shortcuts.toggleSecondarySub` |
| `Ctrl/Cmd+Shift+O` | Open runtime options | `shortcuts.openRuntimeOptions` |
| `Ctrl/Cmd+/` | Open session help | `shortcuts.openSessionHelp` |
| `Ctrl/Cmd+D` | Open character dictionary manager | `shortcuts.openCharacterDictionaryManager` |
| `Ctrl/Cmd+N` | Toggle notification history | `shortcuts.toggleNotificationHistory` |
| `Ctrl/Cmd+A` | Append the video path on the clipboard to the playlist | `shortcuts.appendClipboardVideoToQueue` |
| `Ctrl+Shift+J` | Open Jimaku subtitle search | `shortcuts.openJimaku` |
| `Ctrl+Shift+T` | Open TsukiHime subtitle search | `shortcuts.openTsukihime` |
| `Ctrl+Shift+G` | Open Japanese subtitle generation | `shortcuts.openSubtitleGeneration` |
| Shortcut | Action | Config key |
| ------------------ | ------------------------------------------------------------- | ------------------------------------------ |
| `Ctrl/Cmd+Shift+V` | Cycle secondary subtitle bar: hidden, visible, hover | `shortcuts.toggleSecondarySub` |
| `Ctrl/Cmd+Shift+O` | Open runtime options | `shortcuts.openRuntimeOptions` |
| `Ctrl/Cmd+/` | Open session help | `shortcuts.openSessionHelp` |
| `Ctrl/Cmd+D` | Open character dictionary manager | `shortcuts.openCharacterDictionaryManager` |
| `Ctrl/Cmd+N` | Toggle notification history | `shortcuts.toggleNotificationHistory` |
| `Ctrl/Cmd+A` | Append the video path on the clipboard to the playlist | `shortcuts.appendClipboardVideoToQueue` |
| `Ctrl+Shift+J` | Open Jimaku subtitle search | `shortcuts.openJimaku` |
| `Ctrl+Shift+T` | Open TsukiHime subtitle search | `shortcuts.openTsukihime` |
| `Ctrl+Shift+G` | Open Japanese subtitle generation | `shortcuts.openSubtitleGeneration` |
| `Ctrl+Alt+S` | Sync active subtitle automatically (guided modal on fallback) | `shortcuts.triggerSubsync` |
| `g` then `s` | Pick primary and secondary subtitles (when enabled) | `shortcuts.openSubtitleSelection` |
| `\` | Toggle subtitle sidebar | `subtitleSidebar.toggleKey` |
| `` ` `` | Toggle stats overlay | `stats.toggleKey` |
| `W` | Mark video watched and play the next one in the queue | `stats.markWatchedKey` |
| `Alt+C` | Open controller setup and remapping | `shortcuts.openControllerSelect` |
| `Alt+Shift+C` | Open controller debug view | `shortcuts.openControllerDebug` |
| `g` then `s` | Pick primary and secondary subtitles (when enabled) | `shortcuts.openSubtitleSelection` |
| `\` | Toggle subtitle sidebar | `subtitleSidebar.toggleKey` |
| `` ` `` | Toggle stats overlay | `stats.toggleKey` |
| `W` | Mark video watched and play the next one in the queue | `stats.markWatchedKey` |
| `Alt+C` | Open controller setup and remapping | `shortcuts.openControllerSelect` |
| `Alt+Shift+C` | Open controller debug view | `shortcuts.openControllerDebug` |
While a video is playing, session help can also run commands: highlight a row with the arrow keys or the mouse, then press `Enter` or double-click it. Fixed overlay controls, global shortcuts, `y` chords, the multi-line copy and mine actions, Open session help, and the color legend are reference only. Help opened from the tray with no video loaded is read-only.