mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 12:14:46 -04:00
Type guess from videos
This commit is contained in:
parent
b262aeed5d
commit
b0637aeb6a
@ -1,7 +1,10 @@
|
|||||||
import { t } from "elysia";
|
import { type TSchema, t } from "elysia";
|
||||||
import { comment } from "../utils";
|
import { comment } from "../utils";
|
||||||
import { bubbleVideo, registerExamples } from "./examples";
|
import { bubbleVideo, registerExamples } from "./examples";
|
||||||
|
|
||||||
|
const Guess = <T extends TSchema>(schema: T) =>
|
||||||
|
t.Optional(t.Union([schema, t.Array(schema)]));
|
||||||
|
|
||||||
export const Video = t.Object({
|
export const Video = t.Object({
|
||||||
id: t.String({ format: "uuid" }),
|
id: t.String({ format: "uuid" }),
|
||||||
slug: t.String({ format: "slug" }),
|
slug: t.String({ format: "slug" }),
|
||||||
@ -31,6 +34,26 @@ export const Video = t.Object({
|
|||||||
}),
|
}),
|
||||||
|
|
||||||
createdAt: t.String({ format: "date-time" }),
|
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;
|
export type Video = typeof Video.static;
|
||||||
registerExamples(Video, bubbleVideo);
|
registerExamples(Video, bubbleVideo);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user