mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-02 07:21:33 -07:00
feat(animetosho): add English/Japanese subtitle download integration (#159)
This commit is contained in:
@@ -5,6 +5,7 @@ export const OVERLAY_HOSTED_MODALS = [
|
||||
'runtime-options',
|
||||
'subsync',
|
||||
'jimaku',
|
||||
'animetosho',
|
||||
'youtube-track-picker',
|
||||
'playlist-browser',
|
||||
'kiku',
|
||||
@@ -95,6 +96,10 @@ export const IPC_CHANNELS = {
|
||||
jimakuSearchEntries: 'jimaku:search-entries',
|
||||
jimakuListFiles: 'jimaku:list-files',
|
||||
jimakuDownloadFile: 'jimaku:download-file',
|
||||
animetoshoSearchEntries: 'animetosho:search-entries',
|
||||
animetoshoListFiles: 'animetosho:list-files',
|
||||
animetoshoDownloadFile: 'animetosho:download-file',
|
||||
animetoshoGetSecondaryLanguages: 'animetosho:get-secondary-languages',
|
||||
kikuBuildMergePreview: 'kiku:build-merge-preview',
|
||||
statsGetOverview: 'stats:get-overview',
|
||||
statsGetDailyRollups: 'stats:get-daily-rollups',
|
||||
@@ -134,6 +139,7 @@ export const IPC_CHANNELS = {
|
||||
runtimeOptionsChanged: 'runtime-options:changed',
|
||||
runtimeOptionsOpen: 'runtime-options:open',
|
||||
jimakuOpen: 'jimaku:open',
|
||||
animetoshoOpen: 'animetosho:open',
|
||||
youtubePickerOpen: 'youtube:picker-open',
|
||||
youtubePickerCancel: 'youtube:picker-cancel',
|
||||
playlistBrowserOpen: 'playlist-browser:open',
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
import type { KikuFieldGroupingChoice, KikuMergePreviewRequest } from '../../types/anki';
|
||||
import type {
|
||||
AnimetoshoDownloadQuery,
|
||||
AnimetoshoFilesQuery,
|
||||
AnimetoshoSearchQuery,
|
||||
JimakuDownloadQuery,
|
||||
JimakuFilesQuery,
|
||||
JimakuSearchQuery,
|
||||
@@ -40,6 +43,7 @@ const SESSION_ACTION_IDS: SessionActionId[] = [
|
||||
'openControllerSelect',
|
||||
'openControllerDebug',
|
||||
'openJimaku',
|
||||
'openAnimetosho',
|
||||
'openYoutubePicker',
|
||||
'openPlaylistBrowser',
|
||||
'replayCurrentSubtitle',
|
||||
@@ -402,6 +406,36 @@ export function parseJimakuDownloadQuery(value: unknown): JimakuDownloadQuery |
|
||||
};
|
||||
}
|
||||
|
||||
export function parseAnimetoshoSearchQuery(value: unknown): AnimetoshoSearchQuery | null {
|
||||
if (!isObject(value) || typeof value.query !== 'string') return null;
|
||||
return { query: value.query };
|
||||
}
|
||||
|
||||
export function parseAnimetoshoFilesQuery(value: unknown): AnimetoshoFilesQuery | null {
|
||||
if (!isObject(value) || !isInteger(value.entryId)) return null;
|
||||
return { entryId: value.entryId };
|
||||
}
|
||||
|
||||
export function parseAnimetoshoDownloadQuery(value: unknown): AnimetoshoDownloadQuery | null {
|
||||
if (!isObject(value)) return null;
|
||||
if (
|
||||
!isInteger(value.entryId) ||
|
||||
typeof value.url !== 'string' ||
|
||||
typeof value.name !== 'string'
|
||||
) {
|
||||
return null;
|
||||
}
|
||||
if (value.lang !== undefined && typeof value.lang !== 'string') {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
entryId: value.entryId,
|
||||
url: value.url,
|
||||
name: value.name,
|
||||
lang: value.lang,
|
||||
};
|
||||
}
|
||||
|
||||
export function parseYoutubePickerResolveRequest(
|
||||
value: unknown,
|
||||
): YoutubePickerResolveRequest | null {
|
||||
|
||||
Reference in New Issue
Block a user