mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 04:04:21 -04:00
Type guess info in db schema
This commit is contained in:
parent
6b0e3e7577
commit
b69cb05088
@ -9,6 +9,7 @@ import {
|
|||||||
uuid,
|
uuid,
|
||||||
varchar,
|
varchar,
|
||||||
} from "drizzle-orm/pg-core";
|
} from "drizzle-orm/pg-core";
|
||||||
|
import type { Guess } from "~/models/video";
|
||||||
import { entries } from "./entries";
|
import { entries } from "./entries";
|
||||||
import { schema } from "./utils";
|
import { schema } from "./utils";
|
||||||
|
|
||||||
@ -21,7 +22,7 @@ export const videos = schema.table(
|
|||||||
rendering: text().notNull(),
|
rendering: text().notNull(),
|
||||||
part: integer(),
|
part: integer(),
|
||||||
version: integer().notNull().default(1),
|
version: integer().notNull().default(1),
|
||||||
guess: jsonb().notNull().default({}),
|
guess: jsonb().$type<Guess>().notNull(),
|
||||||
|
|
||||||
createdAt: timestamp({ withTimezone: true, mode: "string" })
|
createdAt: timestamp({ withTimezone: true, mode: "string" })
|
||||||
.notNull()
|
.notNull()
|
||||||
|
@ -3,6 +3,42 @@ import { type Prettify, comment } from "~/utils";
|
|||||||
import { bubbleVideo, registerExamples } from "./examples";
|
import { bubbleVideo, registerExamples } from "./examples";
|
||||||
import { DbMetadata, Resource } from "./utils";
|
import { DbMetadata, Resource } from "./utils";
|
||||||
|
|
||||||
|
export const Guess = t.Recursive((Self) =>
|
||||||
|
t.Object(
|
||||||
|
{
|
||||||
|
title: t.String(),
|
||||||
|
year: t.Optional(t.Array(t.Integer(), { default: [] })),
|
||||||
|
season: t.Optional(t.Array(t.Integer(), { default: [] })),
|
||||||
|
episode: t.Optional(t.Array(t.Integer(), { default: [] })),
|
||||||
|
// TODO: maybe replace "extra" with the `extraKind` value (aka behind-the-scene, trailer, etc)
|
||||||
|
kind: t.Optional(t.UnionEnum(["episode", "movie", "extra"])),
|
||||||
|
|
||||||
|
from: t.String({
|
||||||
|
description: "Name of the tool that made the guess",
|
||||||
|
}),
|
||||||
|
history: t.Optional(
|
||||||
|
t.Array(t.Omit(Self, ["history"]), {
|
||||||
|
default: [],
|
||||||
|
description: comment`
|
||||||
|
When another tool refines the guess or a user manually edit it, the history of the guesses
|
||||||
|
are kept in this \`history\` value.
|
||||||
|
`,
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
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 Guess = typeof Guess.static;
|
||||||
|
|
||||||
export const SeedVideo = t.Object({
|
export const SeedVideo = t.Object({
|
||||||
path: t.String(),
|
path: t.String(),
|
||||||
rendering: t.String({
|
rendering: t.String({
|
||||||
@ -29,42 +65,7 @@ export const SeedVideo = t.Object({
|
|||||||
"Kyoo will prefer playing back the highest `version` number if there are multiples rendering.",
|
"Kyoo will prefer playing back the highest `version` number if there are multiples rendering.",
|
||||||
}),
|
}),
|
||||||
|
|
||||||
guess: t.Optional(
|
guess: t.Optional(Guess),
|
||||||
t.Recursive((Self) =>
|
|
||||||
t.Object(
|
|
||||||
{
|
|
||||||
title: t.String(),
|
|
||||||
year: t.Optional(t.Array(t.Integer(), { default: [] })),
|
|
||||||
season: t.Optional(t.Array(t.Integer(), { default: [] })),
|
|
||||||
episode: t.Optional(t.Array(t.Integer(), { default: [] })),
|
|
||||||
// TODO: maybe replace "extra" with the `extraKind` value (aka behind-the-scene, trailer, etc)
|
|
||||||
kind: t.Optional(t.UnionEnum(["episode", "movie", "extra"])),
|
|
||||||
|
|
||||||
from: t.String({
|
|
||||||
description: "Name of the tool that made the guess",
|
|
||||||
}),
|
|
||||||
history: t.Optional(
|
|
||||||
t.Array(t.Omit(Self, ["history"]), {
|
|
||||||
default: [],
|
|
||||||
description: comment`
|
|
||||||
When another tool refines the guess or a user manually edit it, the history of the guesses
|
|
||||||
are kept in this \`history\` value.
|
|
||||||
`,
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
},
|
|
||||||
{
|
|
||||||
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 SeedVideo = typeof SeedVideo.static;
|
export type SeedVideo = typeof SeedVideo.static;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user