Skip to content

Commit

Permalink
add_getSubtitleFormatsList
Browse files Browse the repository at this point in the history
  • Loading branch information
oupen authored and Bramart committed May 28, 2024
1 parent 28e5c73 commit c4860d4
Show file tree
Hide file tree
Showing 2 changed files with 40 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 @@ -17,6 +17,7 @@ import {
ShowKind,
ShowPath,
SubtitleFormatApi,
SubtitleFormats,
} from "./types.ts";
import { Format } from "./formats.ts";

Expand Down Expand Up @@ -294,6 +295,17 @@ export class Nomalab {
return response.json() as Promise<DeliverableOrganization[]>;
}

async getSubtitleFormatsList(): Promise<SubtitleFormats> {
const response = await this.#fetch(`subtitleFormats`, {});
return response.json() as Promise<SubtitleFormats>;
}

#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<Segment[]>;
Expand Down
28 changes: 28 additions & 0 deletions src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit c4860d4

Please sign in to comment.