diff --git a/src/nomalab.ts b/src/nomalab.ts index 0b9ac32..7f44cda 100644 --- a/src/nomalab.ts +++ b/src/nomalab.ts @@ -17,6 +17,7 @@ import { ShowKind, ShowPath, SubtitleFormatApi, + SubtitleFormats, } from "./types.ts"; import { Format } from "./formats.ts"; @@ -294,6 +295,17 @@ export class Nomalab { return response.json() as Promise; } + async getSubtitleFormatsList(): Promise { + const response = await this.#fetch(`subtitleFormats`, {}); + return response.json() as Promise; + } + + #throwError(message: string, response: Response): void { + console.error(message); + console.error(response); + throw new Error(message); + } + async getFileSegments(materialId: string) { const response = await this.#fetch(`files/${materialId}/segments`, {}); return response.json() as Promise; diff --git a/src/types.ts b/src/types.ts index 0a9e5dc..b127a7d 100644 --- a/src/types.ts +++ b/src/types.ts @@ -165,6 +165,34 @@ export interface SubtitleFormatApi { format: string; } +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: Formats.Mapping;