diff --git a/assets/plugins/auto-jimaku/main.js b/assets/plugins/auto-jimaku/main.js deleted file mode 100644 index 1744e621..00000000 --- a/assets/plugins/auto-jimaku/main.js +++ /dev/null @@ -1,51 +0,0 @@ -// Opens the Jimaku subtitle search when a file starts without a Japanese subtitle track. -// It waits a few seconds after the file loads so external subtitles mpv or SubMiner add count. - -const DEFAULT_SETTINGS = { - // Built-in action to run, e.g. `openTsukihime` or `openSubtitleSelection`. - action: 'openJimaku', - // Track `lang` codes that count as Japanese. Track titles with "Japanese" or 日本語 count too. - languages: ['ja', 'jp', 'jpn'], - delayMs: 3_000, - // Also check http(s) streams; Jimaku can only search by name, which streams rarely have. - streams: false, -}; - -const JAPANESE_TITLE = /japanese|日本語/i; - -function activate(ctx) { - const settings = { ...DEFAULT_SETTINGS, ...ctx.settings }; - const languages = new Set(settings.languages.map((lang) => lang.toLowerCase())); - let cancelCheck = null; - let playbackId = null; - - function hasJapaneseSubtitle(trackList) { - return trackList.some( - (track) => - track?.type === 'sub' && - (languages.has(String(track.lang ?? '').toLowerCase()) || - JAPANESE_TITLE.test(String(track.title ?? ''))), - ); - } - - async function check(media) { - cancelCheck = null; - const trackList = await ctx.mpv.getProperty('track-list'); - if (ctx.media.current()?.playbackId !== media.playbackId || !Array.isArray(trackList)) return; - if (hasJapaneseSubtitle(trackList)) return; - ctx.log.info(`No Japanese subtitles for ${media.path}; running ${settings.action}.`); - await ctx.actions.run(settings.action); - } - - ctx.media.on('change', (media) => { - if (media?.playbackId === playbackId) return; - playbackId = media?.playbackId ?? null; - cancelCheck?.(); - cancelCheck = null; - if (!media) return; - if (!settings.streams && /^[a-z]+:\/\//i.test(media.path)) return; - cancelCheck = ctx.after(settings.delayMs, () => check(media)); - }); -} - -module.exports = { activate }; diff --git a/assets/plugins/auto-jimaku/plugin.json b/assets/plugins/auto-jimaku/plugin.json deleted file mode 100644 index 2b720859..00000000 --- a/assets/plugins/auto-jimaku/plugin.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "Auto Jimaku", - "version": "1.0.0", - "apiVersion": 1, - "main": "main.js" -} diff --git a/changes/docs-keyboard-character-navigation.md b/changes/docs-keyboard-character-navigation.md new file mode 100644 index 00000000..0bc1f77f --- /dev/null +++ b/changes/docs-keyboard-character-navigation.md @@ -0,0 +1,4 @@ +type: docs +area: overlay + +- Listed the keyboard-only `C` key in Keyboard shortcuts, and pointed the configuration reference to Controller support for default button actions. diff --git a/changes/plugin-system.md b/changes/plugin-system.md index 43e860ef..53454dfc 100644 --- a/changes/plugin-system.md +++ b/changes/plugin-system.md @@ -5,6 +5,5 @@ area: plugins - Added an example `ai-explain` plugin that sends the current line and its neighbors to `codex exec` and shows a translation or grammar explanation. - Added an example `anki-sync` plugin that syncs Anki to AnkiWeb after you mine cards, once mining goes quiet or playback ends. - Added an example `episode-tags` plugin that tags mined cards with the show and episode, such as `show::Frieren::S01E07`. -- Added an example `auto-jimaku` plugin that opens the Jimaku search when a file starts without a Japanese subtitle track. - Added a versioned plugin API with standalone authoring types, cached playback snapshots, lifecycle cancellation and cleanup, and awaitable mpv commands. Async activation is bounded and actions wait only for their own plugin. Shutdown skips pending loads, runs each deactivation once, and blocks calls from disposed plugins. - Mining events preserve original and kept note ids with the media and subtitle captured when mining starts, so delayed enrichment and merges into older notes keep the source episode. Stats-dashboard cards do not trigger plugin events. Plugin subtitle lookups and mining provenance account for subtitle delay and return timing on the subtitle file's timeline. diff --git a/docs-site/configuration.md b/docs-site/configuration.md index bd0693c9..a8119e65 100644 --- a/docs-site/configuration.md +++ b/docs-site/configuration.md @@ -314,7 +314,7 @@ Adds a modal for choosing mpv's primary and secondary subtitle tracks. Open it w ### Controller support -Gamepad input for the overlay, through the browser Gamepad API. Most actions only work while keyboard-only mode is on; the toggle for that mode, the secondary subtitle hold (`controller.bindings.holdSecondarySub`), pause (`toggleMpvPause`) and the subtitle line actions (`previousSubtitle`, `nextSubtitle`, `replaySubtitle`, `playNextSubtitle`) work either way. Use the `Alt+C` modal to pick a controller and learn bindings, and `Alt+Shift+C` to see raw button and axis values. Default button actions are on [Keyboard shortcuts](/shortcuts). +Gamepad input for the overlay, through the browser Gamepad API. Most actions only work while keyboard-only mode is on; the toggle for that mode, the secondary subtitle hold (`controller.bindings.holdSecondarySub`), pause (`toggleMpvPause`) and the subtitle line actions (`previousSubtitle`, `nextSubtitle`, `replaySubtitle`, `playNextSubtitle`) work either way. Use the `Alt+C` modal to pick a controller and learn bindings, and `Alt+Shift+C` to see raw button and axis values. Default button actions are in [Controller support](/usage#controller-support). | Key | Default | What it does | | ---------------------------------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | diff --git a/docs-site/plugins.md b/docs-site/plugins.md index a0e6a6c9..f9bd7ac9 100644 --- a/docs-site/plugins.md +++ b/docs-site/plugins.md @@ -83,17 +83,6 @@ Anki must be running and logged in to AnkiWeb. Cards mined from the stats dashbo Templates can use `{show}`, `{season}`, `{episode}`, and `{ep}` (`S01E07`, or `E07` when there is no season). When a placeholder has no value, the tag stops before that `::` level, so a movie gets `show::