diff --git a/src/nomalab.ts b/src/nomalab.ts index bfe4174..2ee3a6e 100644 --- a/src/nomalab.ts +++ b/src/nomalab.ts @@ -11,6 +11,7 @@ import { Show, ShowClass, ShowKind, + SubtitleFormats, } from "./types.ts"; import * as mod from "https://deno.land/std@0.148.0/http/cookie.ts"; @@ -374,6 +375,17 @@ export class Nomalab { return response.blob() as Promise; } + async getSubtitleFormatsList(): Promise { + const response = await this.#fetch(`subtitleFormats`, {}); + if (!response.ok) { + this.#throwError( + `ERROR - Can't find subtitleFormatsList .`, + response, + ); + } + return response.json() as Promise; + } + #throwError(message: string, response: Response): void { console.error(message); console.error(response); diff --git a/src/types.ts b/src/types.ts index b676d3b..3c75ee3 100644 --- a/src/types.ts +++ b/src/types.ts @@ -131,6 +131,35 @@ export interface SubtitleFormat { organizationName: string; subtitleFormats: FormatElement[]; } + +export interface SubtitleFormats { + id: string; + name: string; + format: SubtitleFileFormat; + start_timecode?: string; + frame_rate?: FrameRate; + display_standard?: SubtitleDisplayStandard; + offset?: string; +} + +export enum SubtitleFileFormat { + STL = "STL", + WebVTT = "WebVTT", + SRT = "SRT", +} + +export enum SubtitleDisplayStandard { + Open = "Open", + Teletext1 = "Teletext1", + Teletext2 = "Teletext2", +} + +export interface FrameRate { + id: string; + numerator: number; + denominator: number; +} + export interface DeliverPayload { format: string; versionMapping: "VO" | "VD" | "VDVO";