Creates a subtitle item with associated data, and a descriptor object.
// the associated data can be any type;
// the descriptor is used to display the data in IINA's UI
const item = subtitle.item({
name: "Subtitle Name",
language: "English",
rating: 4.5,
downloads: 1000
});
The assiciated data of type T
.
Optional
desc: SubtitleItemDescriptor<T>Descriptor of the assiciated data, which determines how the data should be displayed in IINA's interface. Nornally, the descriptor is set globally by the subtitle provider.
Register a subtitle source provider. If the provider is already registered, it will be replaced with the new one.
subtitle.registerProvider("my-provider", {
search: async () => {
// search for subtitles
const results = await searchSubtitles(core.status.title);
// return an array of subtitle items
return results.map(r => subtitle.item(r));
},
description: (item) => {
// return description for this subtitle item
},
download: async (item) => {
// download the subtitle files for this subtitle item
const paths = await downloadSubtitle(item.data);
return paths;
},
});
A unique ID of the provider.
The SubtitleProvider
with assiciated subtitle data type T
.
See Subtitle Providers for details.
Generated using TypeDoc
The
Subtitle
module provides a way to register custom subtitle downloaers that integrates into IINA's user interface. See Subtitle Provider for details.