From 4b7f750919f9f97b38182a3dd1422c55f0099b88 Mon Sep 17 00:00:00 2001 From: sudacode Date: Sun, 12 Jul 2026 00:48:12 -0700 Subject: [PATCH] feat(animetosho): add English/Japanese subtitle download integration (#159) --- changes/animetosho-english-subtitles.md | 4 + config.example.jsonc | 11 + docs-site/.vitepress/config.ts | 1 + docs-site/animetosho-integration.md | 73 +++ docs-site/public/config.example.jsonc | 11 + docs-site/shortcuts.md | 1 + plugin/subminer/session_bindings.lua | 2 + src/animetosho/fetch-limits.test.ts | 119 +++++ src/animetosho/lang.test.ts | 45 ++ src/animetosho/lang.ts | 70 +++ src/animetosho/utils.test.ts | 233 +++++++++ src/animetosho/utils.ts | Bin 0 -> 10527 bytes src/cli/args.test.ts | 2 + src/cli/args.ts | 8 + src/config/definitions.ts | 15 +- src/config/definitions/defaults-core.ts | 1 + .../definitions/defaults-integrations.ts | 5 + src/config/definitions/options-core.ts | 7 + .../definitions/options-integrations.ts | 12 + src/config/definitions/shared.ts | 1 + src/config/definitions/template-sections.ts | 8 + src/config/resolve/core-domains.ts | 1 + src/config/resolve/subtitle-domains.ts | 17 + src/config/settings/registry.ts | 1 + src/core/services/anki-jimaku-ipc.test.ts | 113 ++++ src/core/services/anki-jimaku-ipc.ts | 124 +++++ src/core/services/anki-jimaku.test.ts | 154 +++++- src/core/services/anki-jimaku.ts | 127 ++++- src/core/services/app-lifecycle.test.ts | 1 + src/core/services/cli-command.test.ts | 1 + src/core/services/cli-command.ts | 6 + src/core/services/ipc-command.test.ts | 4 + src/core/services/ipc-command.ts | 7 + .../services/overlay-shortcut-handler.test.ts | 14 + src/core/services/overlay-shortcut-handler.ts | 13 + src/core/services/overlay-shortcut.test.ts | 4 + src/core/services/overlay-shortcut.ts | 2 + src/core/services/session-actions.test.ts | 1 + src/core/services/session-actions.ts | 4 + src/core/services/session-bindings.test.ts | 1 + src/core/services/session-bindings.ts | 5 + src/core/services/startup-bootstrap.test.ts | 1 + src/core/utils/shortcut-config.ts | 2 + src/jimaku/download-error.test.ts | 28 + src/jimaku/download-redirect.test.ts | 94 ++++ src/jimaku/utils.ts | 47 +- src/main.ts | 22 +- src/main/dependencies.ts | 2 + src/main/ipc-mpv-command.ts | 2 + src/main/overlay-runtime.ts | 8 + src/main/overlay-shortcuts-runtime.ts | 4 + src/main/runtime/animetosho-open.ts | 48 ++ .../composers/ipc-runtime-composer.test.ts | 1 + .../runtime/first-run-setup-service.test.ts | 1 + src/main/runtime/first-run-setup-service.ts | 1 + .../global-shortcuts-runtime-handlers.test.ts | 1 + src/main/runtime/global-shortcuts.test.ts | 1 + .../ipc-bridge-actions-main-deps.test.ts | 1 + src/main/runtime/ipc-bridge-actions.test.ts | 1 + .../runtime/ipc-mpv-command-main-deps.test.ts | 3 + src/main/runtime/ipc-mpv-command-main-deps.ts | 1 + ...verlay-shortcuts-runtime-main-deps.test.ts | 1 + .../overlay-shortcuts-runtime-main-deps.ts | 1 + src/preload.ts | 22 + src/renderer/handlers/keyboard.test.ts | 2 + src/renderer/handlers/keyboard.ts | 5 + src/renderer/index.html | 38 ++ src/renderer/modals/animetosho.test.ts | 388 ++++++++++++++ src/renderer/modals/animetosho.ts | 487 ++++++++++++++++++ src/renderer/modals/session-help-sections.ts | 5 + src/renderer/renderer.ts | 17 + src/renderer/state.ts | 18 + src/renderer/style.css | 44 ++ src/renderer/utils/dom.ts | 26 + src/shared/ipc/contracts.ts | 6 + src/shared/ipc/validators.ts | 34 ++ src/types/config.ts | 7 + src/types/integrations.ts | 42 ++ src/types/runtime.ts | 18 + src/types/session-bindings.ts | 1 + 80 files changed, 2647 insertions(+), 13 deletions(-) create mode 100644 changes/animetosho-english-subtitles.md create mode 100644 docs-site/animetosho-integration.md create mode 100644 src/animetosho/fetch-limits.test.ts create mode 100644 src/animetosho/lang.test.ts create mode 100644 src/animetosho/lang.ts create mode 100644 src/animetosho/utils.test.ts create mode 100644 src/animetosho/utils.ts create mode 100644 src/jimaku/download-error.test.ts create mode 100644 src/jimaku/download-redirect.test.ts create mode 100644 src/main/runtime/animetosho-open.ts create mode 100644 src/renderer/modals/animetosho.test.ts create mode 100644 src/renderer/modals/animetosho.ts diff --git a/changes/animetosho-english-subtitles.md b/changes/animetosho-english-subtitles.md new file mode 100644 index 00000000..60907887 --- /dev/null +++ b/changes/animetosho-english-subtitles.md @@ -0,0 +1,4 @@ +type: added +area: overlay + +- Added an Animetosho integration for downloading English (and Japanese) subtitles, mirroring the Jimaku flow: `Ctrl+Shift+T` (configurable via `shortcuts.openAnimetosho`) opens an in-overlay modal with two language tabs (the first follows `secondarySub.secondarySubLanguages`, defaulting to English; the second is Japanese) that parses the current video filename, searches Animetosho releases, lists extracted text subtitle tracks filtered by the active tab, then downloads the chosen track, decompresses it (requires the `xz` binary), saves it next to the video with a language suffix (`