From 858f385a3a21d10d81c5788bcf61f4862c838835 Mon Sep 17 00:00:00 2001 From: nomalab Date: Wed, 21 Feb 2024 15:07:19 +0100 Subject: [PATCH] add_getSubtitleFormatsList --- src/nomalab.ts | 12 ++++++++++++ src/types.ts | 29 +++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) 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..ffdee50 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; + fileFormat: 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";