feat(animetosho): add English/Japanese subtitle download integration (#159)

This commit is contained in:
2026-07-12 00:48:12 -07:00
committed by GitHub
parent 6ab3d823a4
commit 4b7f750919
80 changed files with 2647 additions and 13 deletions
+7
View File
@@ -10,6 +10,7 @@ import type {
ImmersionTrackingConfig,
ImmersionTrackingRetentionMode,
ImmersionTrackingRetentionPreset,
AnimetoshoConfig,
JellyfinConfig,
JimakuConfig,
JimakuLanguagePreference,
@@ -122,6 +123,7 @@ export interface ShortcutsConfig {
openCharacterDictionaryManager?: string | null;
openRuntimeOptions?: string | null;
openJimaku?: string | null;
openAnimetosho?: string | null;
openSessionHelp?: string | null;
openControllerSelect?: string | null;
openControllerDebug?: string | null;
@@ -147,6 +149,7 @@ export interface Config {
subtitleSidebar?: SubtitleSidebarConfig;
auto_start_overlay?: boolean;
jimaku?: JimakuConfig;
animetosho?: AnimetoshoConfig;
anilist?: AnilistConfig;
yomitan?: YomitanConfig;
jellyfin?: JellyfinConfig;
@@ -303,6 +306,10 @@ export interface ResolvedConfig {
languagePreference: JimakuLanguagePreference;
maxEntryResults: number;
};
animetosho: AnimetoshoConfig & {
apiBaseUrl: string;
maxSearchResults: number;
};
anilist: {
enabled: boolean;
accessToken: string;
+42
View File
@@ -240,3 +240,45 @@ export type JimakuApiResponse<T> = { ok: true; data: T } | { ok: false; error: J
export type JimakuDownloadResult =
| { ok: true; path: string }
| { ok: false; error: JimakuApiError };
export interface AnimetoshoSearchQuery {
query: string;
}
export interface AnimetoshoEntry {
id: number;
title: string;
timestamp: number | null;
totalSize: number | null;
numFiles: number | null;
}
export interface AnimetoshoFilesQuery {
entryId: number;
}
export interface AnimetoshoSubtitleFile {
attachmentId: number;
filename: string;
lang: string;
trackName: string | null;
size: number;
url: string;
sourceFilename: string;
}
export interface AnimetoshoDownloadQuery {
entryId: number;
url: string;
name: string;
lang?: string;
}
export type AnimetoshoApiResponse<T> = JimakuApiResponse<T>;
export type AnimetoshoDownloadResult = JimakuDownloadResult;
export interface AnimetoshoConfig {
apiBaseUrl?: string;
maxSearchResults?: number;
}
+18
View File
@@ -12,6 +12,13 @@ import type {
SessionBindingWarning,
} from './session-bindings';
import type {
AnimetoshoApiResponse,
AnimetoshoDownloadQuery,
AnimetoshoDownloadResult,
AnimetoshoEntry,
AnimetoshoFilesQuery,
AnimetoshoSearchQuery,
AnimetoshoSubtitleFile,
JimakuApiResponse,
JimakuDownloadQuery,
JimakuDownloadResult,
@@ -454,6 +461,14 @@ export interface ElectronAPI {
jimakuSearchEntries: (query: JimakuSearchQuery) => Promise<JimakuApiResponse<JimakuEntry[]>>;
jimakuListFiles: (query: JimakuFilesQuery) => Promise<JimakuApiResponse<JimakuFileEntry[]>>;
jimakuDownloadFile: (query: JimakuDownloadQuery) => Promise<JimakuDownloadResult>;
animetoshoSearchEntries: (
query: AnimetoshoSearchQuery,
) => Promise<AnimetoshoApiResponse<AnimetoshoEntry[]>>;
animetoshoListFiles: (
query: AnimetoshoFilesQuery,
) => Promise<AnimetoshoApiResponse<AnimetoshoSubtitleFile[]>>;
animetoshoDownloadFile: (query: AnimetoshoDownloadQuery) => Promise<AnimetoshoDownloadResult>;
animetoshoGetSecondaryLanguages: () => Promise<string[]>;
quitApp: () => void;
toggleDevTools: () => void;
toggleOverlay: () => void;
@@ -486,6 +501,7 @@ export interface ElectronAPI {
onOpenControllerSelect: (callback: () => void) => void;
onOpenControllerDebug: (callback: () => void) => void;
onOpenJimaku: (callback: () => void) => void;
onOpenAnimetosho: (callback: () => void) => void;
onOpenYoutubeTrackPicker: (callback: (payload: YoutubePickerOpenPayload) => void) => void;
onOpenPlaylistBrowser: (callback: () => void) => void;
onOpenCharacterDictionaryManager: (callback: () => void) => void;
@@ -530,6 +546,7 @@ export interface ElectronAPI {
| 'runtime-options'
| 'subsync'
| 'jimaku'
| 'animetosho'
| 'youtube-track-picker'
| 'playlist-browser'
| 'kiku'
@@ -544,6 +561,7 @@ export interface ElectronAPI {
| 'runtime-options'
| 'subsync'
| 'jimaku'
| 'animetosho'
| 'youtube-track-picker'
| 'playlist-browser'
| 'kiku'
+1
View File
@@ -22,6 +22,7 @@ export type SessionActionId =
| 'openControllerSelect'
| 'openControllerDebug'
| 'openJimaku'
| 'openAnimetosho'
| 'openYoutubePicker'
| 'openPlaylistBrowser'
| 'replayCurrentSubtitle'