Skip to content

Commit

Permalink
add_getSubtitleFormatsList
Browse files Browse the repository at this point in the history
  • Loading branch information
oupen committed Feb 21, 2024
1 parent b37713b commit 0d2a345
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/nomalab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
Show,
ShowClass,
ShowKind,
SubtitleFormats,
} from "./types.ts";
import * as mod from "https://deno.land/[email protected]/http/cookie.ts";

Expand Down Expand Up @@ -374,6 +375,17 @@ export class Nomalab {
return response.blob() as Promise<Blob>;
}

async getSubtitleFormatsList(): Promise<SubtitleFormats> {
const response = await this.#fetch(`subtitleFormats`, {});
if (!response.ok) {
this.#throwError(
`ERROR - Can't find subtitleFormatsList .`,
response,
);
}
return response.json() as Promise<SubtitleFormats>;
}

#throwError(message: string, response: Response): void {
console.error(message);
console.error(response);
Expand Down
29 changes: 29 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,35 @@ export interface SubtitleFormat {
organizationName: string;
subtitleFormats: FormatElement[];
}

export interface SubtitleFormats {
id: string;
name: string;
fileFormat: SubtitleFileFormat;
subtitleTimecode?: string;
subtitleFrameRate?: FrameRate;
displayStandard?: 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";
Expand Down

0 comments on commit 0d2a345

Please sign in to comment.