mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Front: Define Video Quality Enum
This commit is contained in:
parent
4430450431
commit
4332bfee9b
40
front/packages/models/src/resources/quality.ts
Normal file
40
front/packages/models/src/resources/quality.ts
Normal file
@ -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 <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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<typeof QualityP>;
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user