diff options
author | StefanVukovic99 <stefanvukovic44@gmail.com> | 2024-06-27 18:08:42 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-06-27 16:08:42 +0000 |
commit | 603c2c7e1b50d8b06c06848c3e83d241da9437e6 (patch) | |
tree | 2e04bdb57475c630170315678d789751bfeb6444 /types | |
parent | 4e3f23e942252dacb31780de30f0233eccf1d9f8 (diff) |
add lingua libre audio source (#1129)
* add lingua libre audio source
* mvp
* run file requests in parallel
* remove redundant language var
* redundant api function
---------
Co-authored-by: Cashew <52880648+cashewnuttynuts@users.noreply.github.com>
Diffstat (limited to 'types')
-rw-r--r-- | types/ext/anki-note-builder.d.ts | 2 | ||||
-rw-r--r-- | types/ext/api.d.ts | 1 | ||||
-rw-r--r-- | types/ext/audio-downloader.d.ts | 28 | ||||
-rw-r--r-- | types/ext/language-descriptors.d.ts | 1 | ||||
-rw-r--r-- | types/ext/language.d.ts | 1 | ||||
-rw-r--r-- | types/ext/settings.d.ts | 2 |
6 files changed, 34 insertions, 1 deletions
diff --git a/types/ext/anki-note-builder.d.ts b/types/ext/anki-note-builder.d.ts index 510c0687..9174c563 100644 --- a/types/ext/anki-note-builder.d.ts +++ b/types/ext/anki-note-builder.d.ts @@ -24,6 +24,7 @@ import type * as Extension from './extension'; import type * as Settings from './settings'; import type * as TemplateRenderer from './template-renderer'; import type * as Api from './api'; +import type * as Language from './language'; export type CreateNoteDetails = { dictionaryEntry: Dictionary.DictionaryEntry; @@ -90,6 +91,7 @@ export type AudioMediaOptions = { sources: Audio.AudioSourceInfo[]; preferredAudioIndex: number | null; idleTimeout: number | null; + languageSummary: Language.LanguageSummary; }; export type MediaOptions = { diff --git a/types/ext/api.d.ts b/types/ext/api.d.ts index 3a2fc0b8..46be7938 100644 --- a/types/ext/api.d.ts +++ b/types/ext/api.d.ts @@ -219,6 +219,7 @@ type ApiSurface = { source: Audio.AudioSourceInfo; term: string; reading: string; + languageSummary: Language.LanguageSummary; }; return: AudioDownloader.Info[]; }; diff --git a/types/ext/audio-downloader.d.ts b/types/ext/audio-downloader.d.ts index a785c185..c7f7ecbe 100644 --- a/types/ext/audio-downloader.d.ts +++ b/types/ext/audio-downloader.d.ts @@ -16,11 +16,13 @@ */ import type * as Audio from './audio'; +import type * as Language from './language'; export type GetInfoHandler = ( term: string, reading: string, details?: Audio.AudioSourceInfo, + languageSummary?: Language.LanguageSummary, ) => Promise<Info[]>; export type Info = Info1 | Info2; @@ -52,3 +54,29 @@ export type CustomAudioListSource = { url: string; name?: string; }; + +export type LinguaLibreLookupResponse = { + query: { + search: LinguaLibreLookupResult[]; + }; +}; + +export type LinguaLibreFileResponse = { + query: { + pages: Record<string, LinguaLibreFileResult>; + }; +}; + +export type LinguaLibreLookupResult = { + title: string; +}; + +export type LinguaLibreFileResult = { + title: string; + imageinfo: LinguaLibreFileResultImageInfo[]; +}; + +export type LinguaLibreFileResultImageInfo = { + url: string; + user: string; +}; diff --git a/types/ext/language-descriptors.d.ts b/types/ext/language-descriptors.d.ts index d0136d92..52d4a5d2 100644 --- a/types/ext/language-descriptors.d.ts +++ b/types/ext/language-descriptors.d.ts @@ -27,6 +27,7 @@ type LanguageDescriptor< TTextPostprocessorDescriptor extends TextProcessorDescriptor = Record<string, never>, > = { iso: TIso; + iso639_3: string; name: string; exampleText: string; /** diff --git a/types/ext/language.d.ts b/types/ext/language.d.ts index ea8c0e47..ccc668af 100644 --- a/types/ext/language.d.ts +++ b/types/ext/language.d.ts @@ -63,5 +63,6 @@ export type TextProcessorWithId<T = unknown> = { export type LanguageSummary = { name: string; iso: string; + iso639_3: string; exampleText: string; }; diff --git a/types/ext/settings.d.ts b/types/ext/settings.d.ts index 8183befd..9253efc3 100644 --- a/types/ext/settings.d.ts +++ b/types/ext/settings.d.ts @@ -383,7 +383,7 @@ export type PopupWindowType = 'normal' | 'popup'; export type PopupWindowState = 'normal' | 'maximized' | 'fullscreen'; -export type AudioSourceType = 'jpod101' | 'jpod101-alternate' | 'jisho' | 'text-to-speech' | 'text-to-speech-reading' | 'custom' | 'custom-json'; +export type AudioSourceType = 'jpod101' | 'jpod101-alternate' | 'jisho' | 'lingua-libre' | 'text-to-speech' | 'text-to-speech-reading' | 'custom' | 'custom-json'; export type TranslationConvertType = 'false' | 'true' | 'variant'; |