diff --git a/api/src/models/video.ts b/api/src/models/video.ts index 2987557f..018b4ed6 100644 --- a/api/src/models/video.ts +++ b/api/src/models/video.ts @@ -1,7 +1,10 @@ -import { t } from "elysia"; +import { type TSchema, t } from "elysia"; import { comment } from "../utils"; import { bubbleVideo, registerExamples } from "./examples"; +const Guess = (schema: T) => + t.Optional(t.Union([schema, t.Array(schema)])); + export const Video = t.Object({ id: t.String({ format: "uuid" }), slug: t.String({ format: "slug" }), @@ -31,6 +34,26 @@ export const Video = t.Object({ }), createdAt: t.String({ format: "date-time" }), + + guess: t.Optional( + t.Object( + { + title: t.Optional(t.String()), + year: Guess(t.Integer()), + season: Guess(t.Integer()), + episode: Guess(t.Integer()), + }, + { + additionalProperties: true, + description: comment` + Metadata guessed from the filename. Kyoo can use those informations to bypass + the scanner/metadata fetching and just register videos to movies/entries that already + exists. If Kyoo can't find a matching movie/entry, this information will be sent to + the scanner. + `, + }, + ), + ), }); export type Video = typeof Video.static; registerExamples(Video, bubbleVideo);