mirror of
https://github.com/zoriya/Kyoo.git
synced 2026-05-21 14:46:29 -04:00
Add progress status in every entry
This commit is contained in:
@@ -10,6 +10,7 @@ import {
|
||||
} from "../utils";
|
||||
import { EmbeddedVideo } from "../video";
|
||||
import { BaseEntry, EntryTranslation } from "./base-entry";
|
||||
import { Progress } from "../watchlist";
|
||||
|
||||
export const BaseEpisode = t.Intersect([
|
||||
t.Object({
|
||||
@@ -27,7 +28,8 @@ export const Episode = t.Intersect([
|
||||
EntryTranslation(),
|
||||
BaseEpisode,
|
||||
t.Object({
|
||||
videos: t.Optional(t.Array(EmbeddedVideo)),
|
||||
videos: t.Array(EmbeddedVideo),
|
||||
progress: Progress,
|
||||
}),
|
||||
DbMetadata,
|
||||
]);
|
||||
|
||||
@@ -4,6 +4,7 @@ import { madeInAbyss, registerExamples } from "../examples";
|
||||
import { DbMetadata, SeedImage } from "../utils";
|
||||
import { Resource } from "../utils/resource";
|
||||
import { BaseEntry } from "./base-entry";
|
||||
import { Progress } from "../watchlist";
|
||||
|
||||
export const ExtraType = t.UnionEnum([
|
||||
"other",
|
||||
@@ -31,7 +32,14 @@ export const BaseExtra = t.Intersect(
|
||||
},
|
||||
);
|
||||
|
||||
export const Extra = t.Intersect([Resource(), BaseExtra, DbMetadata]);
|
||||
export const Extra = t.Intersect([
|
||||
Resource(),
|
||||
BaseExtra,
|
||||
t.Object({
|
||||
progress: t.Omit(Progress, ["videoId"]),
|
||||
}),
|
||||
DbMetadata,
|
||||
]);
|
||||
export type Extra = Prettify<typeof Extra.static>;
|
||||
|
||||
export const SeedExtra = t.Intersect([
|
||||
|
||||
@@ -11,6 +11,7 @@ import {
|
||||
} from "../utils";
|
||||
import { EmbeddedVideo } from "../video";
|
||||
import { BaseEntry, EntryTranslation } from "./base-entry";
|
||||
import { Progress } from "../watchlist";
|
||||
|
||||
export const BaseMovieEntry = t.Intersect(
|
||||
[
|
||||
@@ -46,6 +47,7 @@ export const MovieEntry = t.Intersect([
|
||||
BaseMovieEntry,
|
||||
t.Object({
|
||||
videos: t.Optional(t.Array(EmbeddedVideo)),
|
||||
progress: Progress,
|
||||
}),
|
||||
DbMetadata,
|
||||
]);
|
||||
|
||||
@@ -10,6 +10,7 @@ import {
|
||||
} from "../utils";
|
||||
import { EmbeddedVideo } from "../video";
|
||||
import { BaseEntry, EntryTranslation } from "./base-entry";
|
||||
import { Progress } from "../watchlist";
|
||||
|
||||
export const BaseSpecial = t.Intersect(
|
||||
[
|
||||
@@ -38,6 +39,7 @@ export const Special = t.Intersect([
|
||||
BaseSpecial,
|
||||
t.Object({
|
||||
videos: t.Optional(t.Array(EmbeddedVideo)),
|
||||
progress: Progress,
|
||||
}),
|
||||
DbMetadata,
|
||||
]);
|
||||
|
||||
@@ -2,6 +2,7 @@ import { t } from "elysia";
|
||||
import { type Prettify, comment } from "~/utils";
|
||||
import { bubbleImages, registerExamples, youtubeExample } from "../examples";
|
||||
import { DbMetadata, Resource } from "../utils";
|
||||
import { Progress } from "../watchlist";
|
||||
import { BaseEntry, EntryTranslation } from "./base-entry";
|
||||
|
||||
export const BaseUnknownEntry = t.Intersect(
|
||||
@@ -27,6 +28,9 @@ export const UnknownEntry = t.Intersect([
|
||||
Resource(),
|
||||
UnknownEntryTranslation,
|
||||
BaseUnknownEntry,
|
||||
t.Object({
|
||||
progress: t.Omit(Progress, ["videoId"]),
|
||||
}),
|
||||
DbMetadata,
|
||||
]);
|
||||
export type UnknownEntry = Prettify<typeof UnknownEntry.static>;
|
||||
|
||||
@@ -1,10 +1,29 @@
|
||||
import { t } from "elysia";
|
||||
import { comment } from "~/utils";
|
||||
|
||||
export const Progress = t.Object({
|
||||
percent: t.Integer({ minimum: 0, maximum: 100 }),
|
||||
time: t.Number({
|
||||
minimum: 0,
|
||||
description: "When this episode was stopped (in seconds since the start",
|
||||
}),
|
||||
time: t.Nullable(
|
||||
t.Integer({
|
||||
minimum: 0,
|
||||
description: comment`
|
||||
When this episode was stopped (in seconds since the start).
|
||||
This value is null if the entry was never watched or is finished.
|
||||
`,
|
||||
}),
|
||||
),
|
||||
videoId: t.Nullable(
|
||||
t.String({
|
||||
format: "uuid",
|
||||
description: comment`
|
||||
Id of the video the user watched.
|
||||
This can be used to resume playback in the correct video file
|
||||
without asking the user what video to play.
|
||||
|
||||
This will be null if the user did not watch the entry or
|
||||
if the video was deleted since.
|
||||
`,
|
||||
}),
|
||||
),
|
||||
});
|
||||
export type Progress = typeof Progress.static;
|
||||
|
||||
Reference in New Issue
Block a user