12 KiB
Mining Workflow
This guide walks through the sentence mining loop — from watching a video to creating Anki cards with audio, screenshots, and context.
Overview
SubMiner runs as a transparent overlay on top of mpv. As subtitles play, the overlay displays them as interactive text. You hover a word, trigger Yomitan lookup with your configured lookup key/modifier, then create an Anki card with a single action. SubMiner automatically attaches the sentence, audio clip, and screenshot.
Watch video → See subtitle → Hover word + trigger lookup → Yomitan popup → Add to Anki
↓
SubMiner auto-fills:
sentence, audio, image, translation
Subtitle Delivery Path (Startup + Runtime)
SubMiner prioritizes subtitle responsiveness over heavy initialization:
- The first subtitle render is plain text first (no tokenization wait).
- Tokenized enrichment (word spans, known-word flags, JLPT/frequency metadata) is applied right after parsing completes.
- Under rapid subtitle churn, SubMiner uses a latest-only tokenization queue so stale lines are dropped instead of building lag.
- MeCab, Yomitan extension load, and dictionary prewarm run as background warmups after overlay initialization (configurable via
startupWarmups, including low-power mode).
This keeps early playback snappy and avoids mpv-side sluggishness while startup work completes.
Overlay Model
SubMiner uses one overlay window with modal surfaces.
Primary Subtitle Layer
The visible overlay renders subtitles as tokenized hoverable word spans. Each word is a separate element with reading and headword data attached. This plane is styled independently from mpv subtitles and supports:
- Word-level hover targets for Yomitan lookup
- Auto pause/resume on subtitle hover (enabled by default via
subtitleStyle.autoPauseVideoOnHover) - Optional pause while the Yomitan popup is open (
subtitleStyle.autoPauseVideoOnYomitanPopup) - Right-click to pause/resume
- Right-click + drag to reposition subtitles
- Modal dialogs for Jimaku search, field grouping, subsync, and runtime options
- Reading annotations — known words, N+1 targets, character-name matches, JLPT levels, and frequency hits can all be visually highlighted
Toggle visibility with Alt+Shift+O (global) or y-t (mpv plugin).
Secondary Subtitle Bar
The secondary subtitle bar is a compact top-strip region in the same overlay window for translation/context visibility while keeping primary reading flow below. It mirrors your configured secondary subtitle preference and can be independently shown or hidden.
It is controlled by secondarySub configuration and shares lifecycle with the main overlay window.
Modal Surfaces
Jimaku search, field-grouping, runtime options, and manual subsync open as modal surfaces on top of the same overlay window.
Looking Up Words
- Hover over the subtitle area — the overlay activates pointer events.
- Hover the word you want. SubMiner keeps per-token boundaries so Yomitan can target that token cleanly.
- Trigger Yomitan lookup with your configured lookup key/modifier (for example
Shiftif that is how your Yomitan profile is set up). - Yomitan opens its lookup popup for the hovered token.
- From the popup, add the word to Anki.
Controller Workflow
With a gamepad connected and keyboard-only mode enabled, the full mining loop works without a mouse or keyboard:
- Navigate — push the left stick left/right to move the token highlight across subtitle words.
- Look up — press
Ato trigger Yomitan lookup on the highlighted word. - Browse the popup — push the left stick up/down to smooth-scroll through the Yomitan popup, or use the right stick for larger jumps.
- Cycle audio — press
R1to move to the next dictionary audio entry,L1to play the current one. - Mine — press
Xto create an Anki card for the current sentence (same asCtrl+S). - Close — press
Bto dismiss the Yomitan popup and return to subtitle navigation. - Pause/resume — press
L3(left stick click) to toggle mpv pause at any time.
The controller and keyboard can be used interchangeably — switching mid-session is seamless. Toggle keyboard-only mode on or off with Y on the controller.
See Usage — Controller Support for setup details and Configuration — Controller Support for the full mapping and tuning options.
Creating Anki Cards
There are three ways to create cards, depending on your workflow.
1. Auto-Update from Yomitan
This is the most common flow. Yomitan creates a card in Anki, and SubMiner enriches it automatically.
- Hover a word, then trigger Yomitan lookup → Yomitan popup appears.
- Click the Anki icon in Yomitan to add the word.
- SubMiner receives or detects the new card:
- Proxy mode (
ankiConnect.proxy.enabled: true): immediate enrich after successfuladdNote/addNotes. - Polling mode (default): detects via AnkiConnect polling (
ankiConnect.pollingRate, default 3 seconds).
- Proxy mode (
- SubMiner updates the card with:
- Sentence: The current subtitle line.
- Audio: Extracted from the video using the subtitle's start/end timing (plus configurable padding).
- Image: A screenshot or animated clip from the current playback position.
- Translation: From the secondary subtitle track, or generated via AI if configured.
- MiscInfo: Metadata like filename and timestamp.
Configure which fields to fill in ankiConnect.fields. See Anki Integration for details.
2. Manual Update from Clipboard
If you prefer a hands-on approach (animecards-style), you can copy the current subtitle to the clipboard and then paste it onto the last-added Anki card:
- Add a word via Yomitan as usual.
- Press
Ctrl/Cmd+Cto copy the current subtitle line to the clipboard.- For multiple lines: press
Ctrl/Cmd+Shift+C, then a digit1–9to select how many recent subtitle lines to combine. The combined text is copied to the clipboard.
- For multiple lines: press
- Press
Ctrl/Cmd+Vto update the last-added card with the clipboard contents plus audio, image, and translation — the same fields auto-update would fill.
This is useful when auto-update is disabled or when you want explicit control over which subtitle line gets attached to the card.
| Shortcut | Action | Config key |
|---|---|---|
Ctrl/Cmd+C |
Copy current subtitle | shortcuts.copySubtitle |
Ctrl/Cmd+Shift+C + digit |
Copy multiple recent lines | shortcuts.copySubtitleMultiple |
Ctrl/Cmd+V |
Update last card from clipboard | shortcuts.updateLastCardFromClipboard |
3. Mine Sentence (Hotkey)
Create a standalone sentence card without going through Yomitan:
- Mine current sentence:
Ctrl/Cmd+S(configurable viashortcuts.mineSentence) - Mine multiple lines:
Ctrl/Cmd+Shift+Sfollowed by a digit 1–9 to select how many recent subtitle lines to combine.
The sentence card uses the note type configured in isLapis.sentenceCardModel and always maps sentence/audio to Sentence and SentenceAudio.
4. Mark as Audio Card
After adding a word via Yomitan, press the audio card shortcut to overwrite the audio with a longer clip spanning the full subtitle timing.
Secondary Subtitles
SubMiner can display a secondary subtitle track (typically English) alongside the primary Japanese subtitles. This is useful for:
- Quick comprehension checks without leaving the mining flow.
- Auto-populating the translation field on mined cards.
Display Modes
Cycle through modes with the configured shortcut:
- Hidden: Secondary subtitle not shown.
- Visible: Always displayed below the primary subtitle.
- Hover: Only shown when you hover over the primary subtitle.
When a card is created, SubMiner uses the secondary subtitle text as the translation field value (unless AI translation is configured to override it).
Field Grouping (Kiku)
If you mine the same word from different sentences, SubMiner can merge the cards instead of creating duplicates. This feature is designed for use with Kiku and similar note types that support grouped fields.
How It Works
- You add a word via Yomitan.
- SubMiner detects the new card and checks if a card with the same expression already exists.
- If a duplicate is found:
- Auto mode (
fieldGrouping: "auto"): Merges automatically. Both sentences, audio clips, and images are combined into the existing card. The duplicate is optionally deleted. - Manual mode (
fieldGrouping: "manual"): A modal appears showing both cards side by side. You choose which card to keep and preview the merged result before confirming.
- Auto mode (
See Anki Integration — Field Grouping for configuration options, merge behavior, and modal keyboard shortcuts.
Jimaku Subtitle Search
SubMiner integrates with Jimaku to search and download subtitle files for anime directly from the overlay.
- Open the Jimaku modal via the configured shortcut (
Ctrl+Shift+Jby default). - SubMiner auto-fills the search from the current video filename (title, season, episode).
- Browse matching entries and select a subtitle file to download.
- The subtitle is loaded into mpv as a new track.
Requires an internet connection. An API key (jimaku.apiKey) is optional but recommended for higher rate limits.
Texthooker
SubMiner runs a local HTTP server at http://127.0.0.1:5174 (configurable port) that serves a texthooker UI. This allows external tools — such as a browser-based Yomitan instance — to receive subtitle text in real time.
The texthooker page displays the current subtitle and updates as new lines arrive. This is useful if you prefer to do lookups in a browser rather than through the overlay's built-in Yomitan.
Subtitle Sync (Subsync)
If your subtitle file is out of sync with the audio, SubMiner can resynchronize it using alass or ffsubsync.
- Open the subsync modal from the overlay.
- Select the sync engine (alass or ffsubsync).
- For alass, select a reference subtitle track from the video.
- SubMiner runs the sync and reloads the corrected subtitle.
Install the sync tools separately — see Troubleshooting if the tools are not found.
N+1 Word Highlighting
When enabled, SubMiner cross-references your Anki decks to highlight known words in the overlay, making true N+1 sentences (exactly one unknown word) easy to spot during immersion.
See Subtitle Annotations — N+1 for configuration options and color settings.
Immersion Tracking
SubMiner can log your watching and mining activity to a local SQLite database and expose it in the built-in stats dashboard — session times, words seen, cards mined, and daily/monthly rollups.
Enable it in your config:
"immersionTracking": {
"enabled": true,
"dbPath": "" // leave empty to use the default location
}
Open the dashboard in the overlay with stats.toggleKey (default: `), launch it in a browser with subminer stats, or visit http://127.0.0.1:5175 directly if the local stats server is already running.
See Immersion Tracking for dashboard details, schema, and retention settings.
Next: Anki Integration — field mapping, media generation, and card enrichment configuration.