diff --git a/front/packages/models/src/resources/quality.ts b/front/packages/models/src/resources/quality.ts new file mode 100644 index 00000000..af838b9a --- /dev/null +++ b/front/packages/models/src/resources/quality.ts @@ -0,0 +1,40 @@ +/* + * Kyoo - A portable and vast media library solution. + * Copyright (c) Kyoo. + * + * See AUTHORS.md and LICENSE file in the project root for full license information. + * + * Kyoo is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * any later version. + * + * Kyoo is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Kyoo. If not, see . + */ + +import { z } from "zod"; + +export const QualityP = z + .union([ + z.literal("original"), + z.literal("8k"), + z.literal("4k"), + z.literal("1440p"), + z.literal("1080p"), + z.literal("720p"), + z.literal("480p"), + z.literal("360p"), + z.literal("240p"), + ]) + .default("original"); + +/** + * A Video Quality Enum. + */ +export type Quality = z.infer; \ No newline at end of file diff --git a/front/packages/models/src/resources/watch-info.ts b/front/packages/models/src/resources/watch-info.ts index d7ff3137..70e42414 100644 --- a/front/packages/models/src/resources/watch-info.ts +++ b/front/packages/models/src/resources/watch-info.ts @@ -21,6 +21,7 @@ import { z } from "zod"; import { imageFn } from "../traits"; import i18next from "i18next"; +import { QualityP } from "./quality"; const getDisplayName = (sub: Track) => { const languageNames = new Intl.DisplayNames([i18next.language ?? "en"], { type: "language" }); @@ -43,9 +44,9 @@ export const VideoP = z.object({ codec: z.string(), /** * The Quality of the Video - * E.g. "1080p" (TODO: FIND ACTUAL ENUM) + * E.g. "1080p" */ - quality: z.string(), + quality: QualityP, /** * The Width of the Video Frame * E.g. 1424