SIAF / src /sub-router /ffmpeg /validator-v2.ts
GUI-STUDIO
Refactor download/showtime crawling and probing
8bb097e
Raw
History Blame Contribute Delete
2.15 kB
import { Static, Type as t } from "@sinclair/typebox";
const playback = t.Object(
{
url: t.String({
minLength: 1,
errorMessage: "Invalid playback url"
}),
headers: t.Optional(
t.Object(
{},
{
additionalProperties: true,
errorMessage: "Invalid playback headers"
}
)
),
type: t.Union([t.Literal("hls"), t.Literal("video")], {
errorMessage: "Invalid playback type: expected HLS or VIDEO"
}),
protocol: t.Union([t.Literal("http"), t.Literal("local")], {
errorMessage: "Invalid playback type: expected HTTP or LOCAL"
}),
picture_quality: t.Optional(
t.String({
minLength: 0,
errorMessage: "Invalid picture quality"
})
)
},
{ errorMessage: "Invalid playback data" }
);
export type T_playback = Static<typeof playback>;
const live = t.Object(
{
sbe_id: t.Optional(
t.String({
minLength: 0,
errorMessage: "Invalid sbe id"
})
),
delivery_mode: t.Union([t.Literal("download"), t.Literal("stream")], {
errorMessage: "Invalid delivery mode, must be one of: download, stream"
}),
delivery_format: t.Union(
[t.Literal("mp4"), t.Literal("mkv"), t.Literal("ts")],
{
errorMessage: "Invalid output format, must be one of: mp4, mkv, ts"
}
),
delivery_name: t.Optional(
t.String({
minLength: 0,
errorMessage: "Invalid delivery name"
})
),
subtitles: t.Optional(
t.Array(
t.Object(
{
lang: t.String(),
url: t.String(),
title: t.Optional(t.String()),
default: t.Optional(t.Boolean())
},
{ additionalProperties: true }
),
{ errorMessage: "Invalid subtitle data" }
)
),
progress_update_endpoint: t.Optional(
t.String({
minLength: 0,
errorMessage: "Invalid progress update endpoint"
})
)
},
{ errorMessage: "Invalid live data" }
);
export type T_live = Static<typeof live>;
export const NS_validator_v2 = {
playback,
live
};