Commit Graph
628 Commits
Author SHA1 Message Date
sudacode 48a6c0a353 docs(subsync): state precisely what the starts override of the weak-quarter cap relies on 2026-11-28 04:35:50 -08:00
sudacode ab764138af fix(subsync): recheck cancellation after the secondary selection read 2026-11-28 04:33:56 -08:00
sudacode d6d541e51b fix(subsync): address PR review of track identity, tool output, and cancellation
- check the active target's source identity too (mpv reuses freed track ids)
- include device and inode in the source stamp so a retargeted symlink is caught
- reject external-engine output with no readable cues instead of installing it
- leave the user's secondary track alone if they changed it during the lookup
- reject scene-cut splits that would reorder dialogue lines
- document that full line-start agreement overrides the weak-quarter cap
- spawn ffmpeg launchers in their own process group and check aborts before
  spawning (an aborted signal hit a TDZ ReferenceError)
- cache the built-in VAD fallback under its own key so Silero is retried
- kill the tool directly when taskkill exits nonzero
2026-11-28 04:23:39 -08:00
sudacode bd3fe3140d fix(subsync): close remaining cancellation and install races from review
- treat a cancelled run as a changed session at every commit point (writes,
  delay resets, track loads, picker), so nothing lands after a media switch
- fail the secondary track load when the baseline track list cannot be read
- keep the cross-filesystem install atomic by staging next to the target
- register old temp dirs mpv still plays from so they are pruned later
- no detected speech in the combined pass means no audio reference
- start the align worker synchronously so a call cannot post to a stale worker
2026-11-28 04:02:39 -08:00
sudacode cde9362ee5 fix(subsync): address CodeRabbit review of cancellation, cleanup, and writes
- kill a tool's whole POSIX process group on cancel (orphaned children held the
  pipes open, so the run never finished); kill running groups on exit
- refuse an in-place rewrite when the subtitle changed on disk mid-sync
- pick only a freshly added track for the secondary slot, and reset its delay
  only after selecting it
- pass cancellation to the video-reference alass and ffsubsync runs, and never
  open a picker for media the user already left
- treat a failed media-path baseline read as unknown instead of null
- align worker: honor aborts during startup and finish queued calls on the
  main thread when the worker fails to start
- temp dirs: keep failed removals registered, never sweep a dir mpv still
  plays from, and clean up when writing a cleaned reference fails
- an empty cached audio result means no usable audio, as on a fresh decode
- compare external track paths case-sensitively on POSIX
- decode ffmpeg stderr as a stream; coverage lane for subtitle tests
- make the cancellation test wait for the tool to start
2026-11-28 03:53:12 -08:00
sudacode 5b39e850f6 fix(subsync): clean up temp dirs left by embedded and remote track syncs
Syncing an embedded or remote target kept its whole mkdtemp dir (original
extraction plus retimed copy) for the life of the machine. The original is now
removed right away; the dir holding the retimed file mpv loaded is retained
only while mpv lists it, pruned at the next run, removed on exit, and dirs a
crashed session left more than a day ago are swept once per process.
2026-11-28 03:34:55 -08:00
sudacode 732a61ee4b refactor(subsync): share the auto-sync candidate attempt loop
The align, apply-if-confident, else record-best-attempt loop was repeated six
times in runAutoSubsync and the audio-verdict grouping twice. Both now go
through tryReference and groupCandidatesByAudioStatus; behavior is unchanged.
2026-11-28 03:32:29 -08:00
sudacode 935cc1a20f perf(subsync): run alignment in a worker thread
Alignment and candidate scoring take up to ~1s per call on long media and an
auto run makes several, which stalled mpv IPC and the overlay on the main
process. They now run in a reusable worker (src/subsync/align-worker.ts) that
idles out after 30s and falls back to the main thread if it cannot start.
Aborting a run terminates the worker, so cancellation no longer waits for an
in-flight alignment.
2026-11-28 03:30:32 -08:00
sudacode 241aab087f refactor(subsync): split the subsync service into focused modules
subsync.ts (2.4k lines) becomes a small facade over subsync-context (mpv state
and session checks), subsync-files (extract, write, reload), subsync-candidates
(reference discovery and audio), subsync-manual, subsync-auto, and
subsync-shared (deps, thresholds, formatting). Code moved verbatim; public
exports are unchanged.
2026-11-28 03:25:32 -08:00
sudacode 480c8582d8 feat(subsync): cancel running syncs when playback moves to other media
Every run now carries an AbortSignal that fires when mpv's path changes or mpv
disconnects. Spawned ffmpeg, VAD, alass, and ffsubsync are killed (whole tree
on Windows so .cmd shims do not leave the real process behind), candidate loops
and alignment yields stop at the next stage, and the subsync lock is released
right away instead of after minutes of stale work.
2026-11-28 03:23:06 -08:00
sudacode 3b3c6581f4 feat(subsync): keep a one-time backup when replacing subtitles in place
Auto mode rewrites the active subtitle from one keypress with replace on by
default. The first in-place rewrite now copies the original to <file>.orig
(not a subtitle extension, so mpv autoload and sidecar discovery skip it).
Replacements also write through symlinks and keep the file's permissions.
2026-11-28 03:17:10 -08:00
sudacode 24b25287bd 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
2026-11-28 03:15:35 -08:00
sudacode a303d6be27 fix(subsync): correct broadcast windows and partial-fit confidence in aligner
- center each broadcast act's search on the whole-file shift (broke past ~25 min)
- cap confidence when the weakest quarter does not fit (recaps, wrong episodes)
- never let a broadcast result replace a higher-scoring fit
- lower the ambiguity cap below the reference-vs-audio gate
- fix alignNoSplit off-by-one, scene-cut boundary clobbering, and NaN lengths
2026-11-28 03:15:35 -08:00
sudacode f2e82bc556 fix(subsync): harden subtitle parsing, sign heuristics, and ffmpeg extraction
- shift signs and songs with the dialogue line nearest in time, not in file order
- keep the BOM (and add one for non-UTF-8 sources) when rewriting in place
- stop treating full tracks with songs and lines containing a music mark as signs
- skip TTML tracks in local ffmpeg extraction (no decoder)
- do not cache tracks that parsed to zero cues; cap retained ffmpeg stderr
2026-11-28 03:15:35 -08:00
sudacode 71bea8b4d6 fix(subsync): drop stale results when the media file is replaced mid-run
- Check the media file signature again after embedded extraction and drop candidates extracted from a file that was replaced
- Skip publishing the manual picker and auto-sync results if the local file changed during analysis
- Make the tests stricter about stale picker payloads and about ffmpeg calls for cached tracks
2026-11-27 17:32:58 -08:00
sudacode 71d8d9148c fix(subsync): guard embedded track cache against replaced media files
- Capture the file signature before an individual embedded retry and skip caching if the file changed mid-extraction
- Keep cached embedded tracks when the combined single-pass rip fails on a broken track
- Expose getCachedEmbeddedSubtitles and getMediaFileSignature helpers
2026-11-27 17:18:27 -08:00
sudacode ac693be359 perf(subsync): cache retried local embedded tracks across runs
- Add cacheEmbeddedSubtitleTrack to store non-empty individually extracted
  embedded tracks in the single-pass cache for local media
- Picker no longer skips embedded extraction just because a combined pass
  ran, so omitted and zero-event tracks get retried and evaluated
- Later auto-sync runs and picker opens reuse cached retries without
  spawning ffmpeg again
2026-11-27 17:07:15 -08:00
sudacode 69fae42110 fix(subsync): retry omitted and empty batch tracks on local media
- Treat zero-event pre-extracted embedded tracks as missing so they get extracted again one at a time
- Stop skipping embedded extraction on local files just because a combined batch ran, so tracks the batch left out are retried
- Add a test that checks only the failed tracks are retried and that usable batch entries are not extracted again
2026-11-27 11:40:40 -08:00
sudacode 593af920c3 fix(subsync): retry zero-event embedded tracks from combined pass
- Treat batch entries that come back with no subtitle events as missing, so they get retried on their own instead of being skipped
- Tests now check the ffmpeg call order for omitted-track and empty-entry retries
- Apply-error test now forces a sub-add failure and checks the exact OSD message
2026-11-27 09:44:23 -08:00
sudacode 8f87640e4d fix(subsync): retry embedded tracks omitted from partial combined pass
- Remote auto-sync now retries each ranked embedded track individually when the combined ffmpeg pass fails or returns a partial map
- Errors from applying an alignment during the individual fallback now reach the user instead of being swallowed
- Manual alass no longer requires ffmpeg up front, and the Jellyfin path now passes fetchImpl through
- Tests clean up their temp dirs and add coverage for partial batches, external references and apply errors
2026-11-27 00:20:50 -08:00
sudacode 768d3b6a8f fix(subsync): harden auto-sync fallbacks and temp cleanup
- Keep sampled-audio misalignment verdicts when escalated full audio is unavailable
- Try remaining remote embedded tracks one at a time in rank order when the combined rip fails
- Skip the ffmpeg requirement for alass when the reference is fetched over HTTP
- Remove temp dirs when subtitle extraction or write fails
- Build Jellyfin subtitle URLs on the media origin so double-slash paths can't redirect the ApiKey
2026-11-26 22:57:49 -08:00
sudacode 584dfa3608 perf(subsync): avoid streaming remote media for embedded references
- Fetch embedded Jellyfin subtitle tracks through the Subtitles Stream endpoint instead of running ffmpeg over the HTTP stream
- Try external references before extracting embedded tracks on remote streams, and skip embedded extraction when opening the picker
- Run the sampled-audio fast path before the full MKV demux when a non-signs external or sidecar reference exists
- Escalate to a single-pass embedded and audio rip only when sampled verification is inconclusive
2026-11-26 22:07:13 -08:00
sudacode 904eccc4e7 fix(subsync): read subtitle delay before final playback session check 2026-11-25 21:19:06 -08:00
sudacode 58c0dfaed2 fix(subsync): stage external output and harden path and encoding guards 2026-11-25 21:00:32 -08:00
sudacode fc113cfbca fix(subsync): address PR review findings and deterministic CI check 2026-11-25 20:17:25 -08:00
sudacode 8e3d9e21e0 style(subsync): remove em and en dashes from UI strings and comments 2026-11-25 19:57:44 -08:00
sudacode 05bdb64880 feat(subsync): integrate built-in automatic subtitle syncing 2026-11-25 19:47:56 -08:00
sudacode 926e6b047e feat(jellyfin): queue series neighbor episodes in the mpv playlist (#338) 2026-11-24 01:45:27 -08:00
sudacode 713cdb3ef8 fix(anki): stop the new-card poll from dropping mined cards (#339) 2026-11-24 00:05:33 -08:00
sudacode e05fb34f7b chore(release): prepare v0.22.1 v0.22.1 2026-11-23 01:16:55 -08:00
sudacode 93045ebf9f fix(build): extract Yomitan on Windows without the Archive module
PowerShell 7's PSModulePath makes powershell.exe load the PS7 Archive
module, whose ExtractToDirectory overload is missing on .NET Framework,
so Expand-Archive silently extracted nothing on the windows-latest runner.
v0.22.1-beta.2
2026-11-23 00:20:03 -08:00
sudacode 18490c9d4f chore(release): prepare v0.22.1-beta.2 2026-11-23 00:02:21 -08:00
sudacode 78809094d2 fix(jimaku): keep the series name for stream titles containing slashes (#337) 2026-11-22 23:59:19 -08:00
sudacode 71251b8d7b feat(stats): group library seasons, movies and OVAs into franchise cards (#336) 2026-11-22 21:03:23 -08:00
sudacode 9d2057cc30 fix(anilist): resolve later seasons past split-cour halves and specials (#335) 2026-11-22 21:03:11 -08:00
sudacode ac3ceab856 feat(aniskip): detect intros and outros from file chapters and AniSkip v2 (#334) 2026-11-22 21:02:54 -08:00
sudacode ee52664655 feat(setup): download FFmpeg from first-run setup when none is usable (#333) 2026-11-22 02:09:06 -08:00
sudacode 0ae70b4ab2 fix(overlay): keep forwarding mpv keys after a Yomitan popup closes (#332)
Decide whether the Yomitan popup is open from the popup host in the DOM
instead of the cached yomitanPopupVisible flag, which can lag a close and
kept input.conf keys from reaching mpv.

Keep the imported mpv key list in place while a refresh is in flight, so a
key pressed right after the overlay regains focus is not dropped. A failed
reload still clears the list.

At --log-level debug, log why the overlay kept an mpv-bound key
(config-loading, modal, lookup-popup, interactive-target or
no-imported-bindings) over a validated IPC channel.

Refs #331
2026-11-20 18:27:11 -08:00
sudacode 0c1865f4a6 chore(release): prepare v0.22.1-beta.1 v0.22.1-beta.1 2026-11-06 19:07:54 -08:00
sudacode 6fd55053d4 fix(overlay): identify Windows mpv windows through IPC PID (#330) 2026-11-06 18:37:44 -08:00
sudacode 0360270e81 chore(release): v0.22.0 v0.22.0 2026-11-06 00:07:01 -08:00
sudacode a8e929eb26 refactor(controller): remove unused rightStickHorizontal binding
- Drop the Alt Horizontal row from Alt+C; no action read this binding
- Remove the key from config defaults, resolver, IPC validator, and types
- Regenerate config.example.jsonc and remove the inactive-binding exemption
2026-11-05 23:33:31 -08:00
sudacode b31ddce627 feat(controller): add hold + press combos to main bindings (#328)
* feat(controller): add hold + press combos to main bindings

Main Alt+C actions can now be learned as combos such as L1 + D-pad right.
A combo fires on each press while its hold button is down, and claims its
press input so token move and popup scroll ignore it until it is released.
A plain action on a hold button fires on release, unless another bound
button was pressed during the hold.

The save path needed two changes for combos to persist. The IPC validator
rebuilt bindings field by field and dropped `hold`, so Alt+C showed a combo
from its local copy until the next reload turned it back into a plain
button. Validator and config resolver now share one parser. Saves also
replace the controller section, since the deep merge in patchRawConfig kept
the old `hold` when a combo was rebound to one button.

Also fixes Learn on the (D-pad) rows, which threw after cancel() cleared
the capture target.

* test(launcher): wait for content in background child test

The test polled for the fake app's output files to exist, but the shell
creates a redirect target before writing to it. A poll landing in that gap
read an empty env file and failed with '' !== '1', as seen once in CI.
Wait until both files have content instead.

* fix(controller): keep a diagonal push from learning as a combo

Learn took the first axis of a diagonal stick push as the hold and the
second as the press, saving a combo that one axis could never trigger. This
reached main Alt+C rows when they moved to combo capture. Axes crossing the
threshold in the same poll as the first input now count as one movement. A
second axis moved in a later poll still records a combo.

* fix(controller): only treat simultaneous axes as one movement

The diagonal push guard also blocked an axis activated in the same poll as a
button, so L1 plus a stick direction could not record the stick until it was
released and moved again. Apply the guard only when the first input is an
axis, so that input pair records as a combo again.
2026-11-05 23:23:54 -08:00
sudacode 79e5535823 fix(controller): show dialog hints only while a controller is connected
- Add createControllerHintVisibility: use the dialog window's pad, else ask main which controller the overlay is reading, at most once per second while a dialog is open
- Hide shortcut tags when controller support is on but no controller is present
- Update the Anki integration docs and changelog fragments to match
2026-11-05 00:54:25 -08:00
sudacode 5140b5e9be test(overlay): pin an X11 session for Linux assembly tests
Fullscreen recreation only runs outside Hyprland and Sway, and the tests
inherited the running session's compositor variables, so they failed when run
from a Hyprland desktop.
2026-11-04 23:31:11 -08:00
sudacode c2dac537da fix(overlay): keep popup pause working with Hachidori 0.4.0
Hachidori 0.4.0 closed its popup shadow root, so isHachidoriPopupOpen always
returned false. The popup never took over the subtitle hover pause, and moving
off the subtitle resumed playback with the popup open. Popup key and controller
routing read the same check. The sidebar kept working because its hold follows
the attention event instead of the pane.

The fork now publishes the pane state on the host element, and the renderer
reads that attribute instead of upstream's shadow root and CSS class. The unit
stubs modelled an open root and hid this, so test:dictionary:electron now drives
the real reader and asserts the attribute follows the pane.
2026-11-04 22:46:25 -08:00
sudacode bc7e82fee6 build(deps): remove @discordjs/rest undici patch
- Drop the patchedDependencies entry from package.json and bun.lock
- Delete patches/@discordjs%2Frest@2.6.1.patch, which pinned undici to 6.27.0
2026-11-04 22:05:32 -08:00
sudacode c3e672efdb refactor(plugins): remove auto-jimaku example plugin and fix docs
- Remove the auto-jimaku example, now covered by the built-in Jimaku auto-open
- Drop its plugins docs section and changelog bullet
- List the keyboard-only `C` key in Keyboard shortcuts
- Point the configuration reference to Controller support for button defaults
2026-11-04 22:02:05 -08:00
sudacode 269c0708cb feat(stats): overhaul the Trends tab (#325) 2026-11-04 21:55:18 -08:00
sudacode f89f78b861 refactor(main): move plugins, session actions and subtitle generation into assemblies (#327)
* refactor(main): build overlay geometry and pointer interaction in the overlay assembly

Inject Electron's screen (and the stats-window promotion) into the overlay geometry and
visible-overlay interaction runtimes so they load under bun test, then construct both in
createOverlayAssembly together with the overlay visibility composer and the mpv subtitle
suppression handlers. Replace the three regex tests that pinned the moved Linux input and
shape code with behaviour tests on the runtimes.

* refactor(main): move the autoplay-ready gate into the playback assembly

The autoplay-ready gate, its post-warm subtitle prime, the current-media tokenization gate and
managed local subtitle selection all read playback state, and playback signals through the
gate, so createPlaybackAssembly now builds them. The overlay reaches the gate through a getter.

Replace the last four regex guards with behaviour tests: the gate holds the release until the
visible overlay has measured the line and ignores untokenized lines during warmup (playback),
cached autoplay priming never paints raw first and the sidebar media path is tagged only after
prefetch loads (priming runtime), and dashboard mining overrides the Hachidori Anki server only
when the proxy is on (stats server runtime). main-wiring.test.ts is now empty and removed.

* refactor(main): move the plugin host, panel and windows into a plugins assembly

* refactor(main): move session action dispatch and renderer mpv commands into an assembly

createSessionActionsAssembly owns the session action dispatcher, the secondary-subtitle mode cycle, queueing the clipboard's video, and the mpv commands the overlay renderer sends. The runtime option cycle both paths used is now one function.

* refactor(main): move Whisper subtitle generation into an assembly

* refactor(main): resolve subtitle annotation options in a runtime module

The runtime-option-over-config resolution that the texthooker page and the MeCab startup decision share moves out of main.ts into createAnnotationOptions.

* test(main): cover a non-boolean runtime annotation option value

* docs: describe the plugins, session actions and subtitle generation assemblies

Update ownership for overlay geometry and pointer interaction, the autoplay-ready gate, and annotation options; point the overlay priming entry points at their new modules; the main-wiring regex debt is gone.

* build: export MpvClientEvents so declaration emit can name the plugins assembly's return type
2026-11-04 21:54:49 -08:00