diff options
Diffstat (limited to 'packages/models/src/videos')
94 files changed, 1071 insertions, 0 deletions
diff --git a/packages/models/src/videos/blacklist/index.ts b/packages/models/src/videos/blacklist/index.ts new file mode 100644 index 000000000..5eb36ad48 --- /dev/null +++ b/packages/models/src/videos/blacklist/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './video-blacklist.model.js' | ||
2 | export * from './video-blacklist-create.model.js' | ||
3 | export * from './video-blacklist-update.model.js' | ||
diff --git a/packages/models/src/videos/blacklist/video-blacklist-create.model.ts b/packages/models/src/videos/blacklist/video-blacklist-create.model.ts new file mode 100644 index 000000000..6e7d36421 --- /dev/null +++ b/packages/models/src/videos/blacklist/video-blacklist-create.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface VideoBlacklistCreate { | ||
2 | reason?: string | ||
3 | unfederate?: boolean | ||
4 | } | ||
diff --git a/packages/models/src/videos/blacklist/video-blacklist-update.model.ts b/packages/models/src/videos/blacklist/video-blacklist-update.model.ts new file mode 100644 index 000000000..0a86cf7b0 --- /dev/null +++ b/packages/models/src/videos/blacklist/video-blacklist-update.model.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface VideoBlacklistUpdate { | ||
2 | reason?: string | ||
3 | } | ||
diff --git a/packages/models/src/videos/blacklist/video-blacklist.model.ts b/packages/models/src/videos/blacklist/video-blacklist.model.ts new file mode 100644 index 000000000..1ca5bbbb7 --- /dev/null +++ b/packages/models/src/videos/blacklist/video-blacklist.model.ts | |||
@@ -0,0 +1,20 @@ | |||
1 | import { Video } from '../video.model.js' | ||
2 | |||
3 | export const VideoBlacklistType = { | ||
4 | MANUAL: 1, | ||
5 | AUTO_BEFORE_PUBLISHED: 2 | ||
6 | } as const | ||
7 | |||
8 | export type VideoBlacklistType_Type = typeof VideoBlacklistType[keyof typeof VideoBlacklistType] | ||
9 | |||
10 | export interface VideoBlacklist { | ||
11 | id: number | ||
12 | unfederated: boolean | ||
13 | reason?: string | ||
14 | type: VideoBlacklistType_Type | ||
15 | |||
16 | video: Video | ||
17 | |||
18 | createdAt: Date | ||
19 | updatedAt: Date | ||
20 | } | ||
diff --git a/packages/models/src/videos/caption/index.ts b/packages/models/src/videos/caption/index.ts new file mode 100644 index 000000000..a175768ce --- /dev/null +++ b/packages/models/src/videos/caption/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './video-caption.model.js' | ||
2 | export * from './video-caption-update.model.js' | ||
diff --git a/packages/models/src/videos/caption/video-caption-update.model.ts b/packages/models/src/videos/caption/video-caption-update.model.ts new file mode 100644 index 000000000..ff5728715 --- /dev/null +++ b/packages/models/src/videos/caption/video-caption-update.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface VideoCaptionUpdate { | ||
2 | language: string | ||
3 | captionfile: Blob | ||
4 | } | ||
diff --git a/packages/models/src/videos/caption/video-caption.model.ts b/packages/models/src/videos/caption/video-caption.model.ts new file mode 100644 index 000000000..d6d625ff7 --- /dev/null +++ b/packages/models/src/videos/caption/video-caption.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { VideoConstant } from '../video-constant.model.js' | ||
2 | |||
3 | export interface VideoCaption { | ||
4 | language: VideoConstant<string> | ||
5 | captionPath: string | ||
6 | updatedAt: string | ||
7 | } | ||
diff --git a/packages/models/src/videos/change-ownership/index.ts b/packages/models/src/videos/change-ownership/index.ts new file mode 100644 index 000000000..6cf568f4e --- /dev/null +++ b/packages/models/src/videos/change-ownership/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './video-change-ownership-accept.model.js' | ||
2 | export * from './video-change-ownership-create.model.js' | ||
3 | export * from './video-change-ownership.model.js' | ||
diff --git a/packages/models/src/videos/change-ownership/video-change-ownership-accept.model.ts b/packages/models/src/videos/change-ownership/video-change-ownership-accept.model.ts new file mode 100644 index 000000000..f27247633 --- /dev/null +++ b/packages/models/src/videos/change-ownership/video-change-ownership-accept.model.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface VideoChangeOwnershipAccept { | ||
2 | channelId: number | ||
3 | } | ||
diff --git a/packages/models/src/videos/change-ownership/video-change-ownership-create.model.ts b/packages/models/src/videos/change-ownership/video-change-ownership-create.model.ts new file mode 100644 index 000000000..40fcca285 --- /dev/null +++ b/packages/models/src/videos/change-ownership/video-change-ownership-create.model.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface VideoChangeOwnershipCreate { | ||
2 | username: string | ||
3 | } | ||
diff --git a/packages/models/src/videos/change-ownership/video-change-ownership.model.ts b/packages/models/src/videos/change-ownership/video-change-ownership.model.ts new file mode 100644 index 000000000..353db37f0 --- /dev/null +++ b/packages/models/src/videos/change-ownership/video-change-ownership.model.ts | |||
@@ -0,0 +1,19 @@ | |||
1 | import { Account } from '../../actors/index.js' | ||
2 | import { Video } from '../video.model.js' | ||
3 | |||
4 | export interface VideoChangeOwnership { | ||
5 | id: number | ||
6 | status: VideoChangeOwnershipStatusType | ||
7 | initiatorAccount: Account | ||
8 | nextOwnerAccount: Account | ||
9 | video: Video | ||
10 | createdAt: Date | ||
11 | } | ||
12 | |||
13 | export const VideoChangeOwnershipStatus = { | ||
14 | WAITING: 'WAITING', | ||
15 | ACCEPTED: 'ACCEPTED', | ||
16 | REFUSED: 'REFUSED' | ||
17 | } as const | ||
18 | |||
19 | export type VideoChangeOwnershipStatusType = typeof VideoChangeOwnershipStatus[keyof typeof VideoChangeOwnershipStatus] | ||
diff --git a/packages/models/src/videos/channel-sync/index.ts b/packages/models/src/videos/channel-sync/index.ts new file mode 100644 index 000000000..206cbe1b6 --- /dev/null +++ b/packages/models/src/videos/channel-sync/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './video-channel-sync-state.enum.js' | ||
2 | export * from './video-channel-sync.model.js' | ||
3 | export * from './video-channel-sync-create.model.js' | ||
diff --git a/packages/models/src/videos/channel-sync/video-channel-sync-create.model.ts b/packages/models/src/videos/channel-sync/video-channel-sync-create.model.ts new file mode 100644 index 000000000..753a8ee4c --- /dev/null +++ b/packages/models/src/videos/channel-sync/video-channel-sync-create.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface VideoChannelSyncCreate { | ||
2 | externalChannelUrl: string | ||
3 | videoChannelId: number | ||
4 | } | ||
diff --git a/packages/models/src/videos/channel-sync/video-channel-sync-state.enum.ts b/packages/models/src/videos/channel-sync/video-channel-sync-state.enum.ts new file mode 100644 index 000000000..047444bbc --- /dev/null +++ b/packages/models/src/videos/channel-sync/video-channel-sync-state.enum.ts | |||
@@ -0,0 +1,8 @@ | |||
1 | export const VideoChannelSyncState = { | ||
2 | WAITING_FIRST_RUN: 1, | ||
3 | PROCESSING: 2, | ||
4 | SYNCED: 3, | ||
5 | FAILED: 4 | ||
6 | } as const | ||
7 | |||
8 | export type VideoChannelSyncStateType = typeof VideoChannelSyncState[keyof typeof VideoChannelSyncState] | ||
diff --git a/packages/models/src/videos/channel-sync/video-channel-sync.model.ts b/packages/models/src/videos/channel-sync/video-channel-sync.model.ts new file mode 100644 index 000000000..38ac99668 --- /dev/null +++ b/packages/models/src/videos/channel-sync/video-channel-sync.model.ts | |||
@@ -0,0 +1,14 @@ | |||
1 | import { VideoChannelSummary } from '../channel/video-channel.model.js' | ||
2 | import { VideoConstant } from '../video-constant.model.js' | ||
3 | import { VideoChannelSyncStateType } from './video-channel-sync-state.enum.js' | ||
4 | |||
5 | export interface VideoChannelSync { | ||
6 | id: number | ||
7 | |||
8 | externalChannelUrl: string | ||
9 | |||
10 | createdAt: string | ||
11 | channel: VideoChannelSummary | ||
12 | state: VideoConstant<VideoChannelSyncStateType> | ||
13 | lastSyncAt: string | ||
14 | } | ||
diff --git a/packages/models/src/videos/channel/index.ts b/packages/models/src/videos/channel/index.ts new file mode 100644 index 000000000..3c96e80f0 --- /dev/null +++ b/packages/models/src/videos/channel/index.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export * from './video-channel-create-result.model.js' | ||
2 | export * from './video-channel-create.model.js' | ||
3 | export * from './video-channel-update.model.js' | ||
4 | export * from './video-channel.model.js' | ||
diff --git a/packages/models/src/videos/channel/video-channel-create-result.model.ts b/packages/models/src/videos/channel/video-channel-create-result.model.ts new file mode 100644 index 000000000..e3d7aeb4c --- /dev/null +++ b/packages/models/src/videos/channel/video-channel-create-result.model.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface VideoChannelCreateResult { | ||
2 | id: number | ||
3 | } | ||
diff --git a/packages/models/src/videos/channel/video-channel-create.model.ts b/packages/models/src/videos/channel/video-channel-create.model.ts new file mode 100644 index 000000000..da8ce620c --- /dev/null +++ b/packages/models/src/videos/channel/video-channel-create.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export interface VideoChannelCreate { | ||
2 | name: string | ||
3 | displayName: string | ||
4 | description?: string | ||
5 | support?: string | ||
6 | } | ||
diff --git a/packages/models/src/videos/channel/video-channel-update.model.ts b/packages/models/src/videos/channel/video-channel-update.model.ts new file mode 100644 index 000000000..8dde9188b --- /dev/null +++ b/packages/models/src/videos/channel/video-channel-update.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export interface VideoChannelUpdate { | ||
2 | displayName?: string | ||
3 | description?: string | ||
4 | support?: string | ||
5 | |||
6 | bulkVideosSupportUpdate?: boolean | ||
7 | } | ||
diff --git a/packages/models/src/videos/channel/video-channel.model.ts b/packages/models/src/videos/channel/video-channel.model.ts new file mode 100644 index 000000000..bb10f6da5 --- /dev/null +++ b/packages/models/src/videos/channel/video-channel.model.ts | |||
@@ -0,0 +1,34 @@ | |||
1 | import { Account, ActorImage } from '../../actors/index.js' | ||
2 | import { Actor } from '../../actors/actor.model.js' | ||
3 | |||
4 | export type ViewsPerDate = { | ||
5 | date: Date | ||
6 | views: number | ||
7 | } | ||
8 | |||
9 | export interface VideoChannel extends Actor { | ||
10 | displayName: string | ||
11 | description: string | ||
12 | support: string | ||
13 | isLocal: boolean | ||
14 | |||
15 | updatedAt: Date | string | ||
16 | |||
17 | ownerAccount?: Account | ||
18 | |||
19 | videosCount?: number | ||
20 | viewsPerDay?: ViewsPerDate[] // chronologically ordered | ||
21 | totalViews?: number | ||
22 | |||
23 | banners: ActorImage[] | ||
24 | } | ||
25 | |||
26 | export interface VideoChannelSummary { | ||
27 | id: number | ||
28 | name: string | ||
29 | displayName: string | ||
30 | url: string | ||
31 | host: string | ||
32 | |||
33 | avatars: ActorImage[] | ||
34 | } | ||
diff --git a/packages/models/src/videos/comment/index.ts b/packages/models/src/videos/comment/index.ts new file mode 100644 index 000000000..bd26c652d --- /dev/null +++ b/packages/models/src/videos/comment/index.ts | |||
@@ -0,0 +1,2 @@ | |||
1 | export * from './video-comment-create.model.js' | ||
2 | export * from './video-comment.model.js' | ||
diff --git a/packages/models/src/videos/comment/video-comment-create.model.ts b/packages/models/src/videos/comment/video-comment-create.model.ts new file mode 100644 index 000000000..1f0135405 --- /dev/null +++ b/packages/models/src/videos/comment/video-comment-create.model.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface VideoCommentCreate { | ||
2 | text: string | ||
3 | } | ||
diff --git a/packages/models/src/videos/comment/video-comment.model.ts b/packages/models/src/videos/comment/video-comment.model.ts new file mode 100644 index 000000000..e2266545a --- /dev/null +++ b/packages/models/src/videos/comment/video-comment.model.ts | |||
@@ -0,0 +1,45 @@ | |||
1 | import { ResultList } from '../../common/index.js' | ||
2 | import { Account } from '../../actors/index.js' | ||
3 | |||
4 | export interface VideoComment { | ||
5 | id: number | ||
6 | url: string | ||
7 | text: string | ||
8 | threadId: number | ||
9 | inReplyToCommentId: number | ||
10 | videoId: number | ||
11 | createdAt: Date | string | ||
12 | updatedAt: Date | string | ||
13 | deletedAt: Date | string | ||
14 | isDeleted: boolean | ||
15 | totalRepliesFromVideoAuthor: number | ||
16 | totalReplies: number | ||
17 | account: Account | ||
18 | } | ||
19 | |||
20 | export interface VideoCommentAdmin { | ||
21 | id: number | ||
22 | url: string | ||
23 | text: string | ||
24 | |||
25 | threadId: number | ||
26 | inReplyToCommentId: number | ||
27 | |||
28 | createdAt: Date | string | ||
29 | updatedAt: Date | string | ||
30 | |||
31 | account: Account | ||
32 | |||
33 | video: { | ||
34 | id: number | ||
35 | uuid: string | ||
36 | name: string | ||
37 | } | ||
38 | } | ||
39 | |||
40 | export type VideoCommentThreads = ResultList<VideoComment> & { totalNotDeletedComments: number } | ||
41 | |||
42 | export interface VideoCommentThreadTree { | ||
43 | comment: VideoComment | ||
44 | children: VideoCommentThreadTree[] | ||
45 | } | ||
diff --git a/packages/models/src/videos/file/index.ts b/packages/models/src/videos/file/index.ts new file mode 100644 index 000000000..ee06f4e20 --- /dev/null +++ b/packages/models/src/videos/file/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './video-file-metadata.model.js' | ||
2 | export * from './video-file.model.js' | ||
3 | export * from './video-resolution.enum.js' | ||
diff --git a/packages/models/src/videos/file/video-file-metadata.model.ts b/packages/models/src/videos/file/video-file-metadata.model.ts new file mode 100644 index 000000000..8f527c0a7 --- /dev/null +++ b/packages/models/src/videos/file/video-file-metadata.model.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | export class VideoFileMetadata { | ||
2 | streams: { [x: string]: any, [x: number]: any }[] | ||
3 | format: { [x: string]: any, [x: number]: any } | ||
4 | chapters: any[] | ||
5 | |||
6 | constructor (hash: { chapters: any[], format: any, streams: any[] }) { | ||
7 | this.chapters = hash.chapters | ||
8 | this.format = hash.format | ||
9 | this.streams = hash.streams | ||
10 | |||
11 | delete this.format.filename | ||
12 | } | ||
13 | } | ||
diff --git a/packages/models/src/videos/file/video-file.model.ts b/packages/models/src/videos/file/video-file.model.ts new file mode 100644 index 000000000..2ed1ac4be --- /dev/null +++ b/packages/models/src/videos/file/video-file.model.ts | |||
@@ -0,0 +1,22 @@ | |||
1 | import { VideoConstant } from '../video-constant.model.js' | ||
2 | import { VideoFileMetadata } from './video-file-metadata.model.js' | ||
3 | |||
4 | export interface VideoFile { | ||
5 | id: number | ||
6 | |||
7 | resolution: VideoConstant<number> | ||
8 | size: number // Bytes | ||
9 | |||
10 | torrentUrl: string | ||
11 | torrentDownloadUrl: string | ||
12 | |||
13 | fileUrl: string | ||
14 | fileDownloadUrl: string | ||
15 | |||
16 | fps: number | ||
17 | |||
18 | metadata?: VideoFileMetadata | ||
19 | metadataUrl?: string | ||
20 | |||
21 | magnetUri: string | null | ||
22 | } | ||
diff --git a/packages/models/src/videos/file/video-resolution.enum.ts b/packages/models/src/videos/file/video-resolution.enum.ts new file mode 100644 index 000000000..434e8c36d --- /dev/null +++ b/packages/models/src/videos/file/video-resolution.enum.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | export const VideoResolution = { | ||
2 | H_NOVIDEO: 0, | ||
3 | H_144P: 144, | ||
4 | H_240P: 240, | ||
5 | H_360P: 360, | ||
6 | H_480P: 480, | ||
7 | H_720P: 720, | ||
8 | H_1080P: 1080, | ||
9 | H_1440P: 1440, | ||
10 | H_4K: 2160 | ||
11 | } as const | ||
12 | |||
13 | export type VideoResolutionType = typeof VideoResolution[keyof typeof VideoResolution] | ||
diff --git a/packages/models/src/videos/import/index.ts b/packages/models/src/videos/import/index.ts new file mode 100644 index 000000000..6701674c5 --- /dev/null +++ b/packages/models/src/videos/import/index.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export * from './video-import-create.model.js' | ||
2 | export * from './video-import-state.enum.js' | ||
3 | export * from './video-import.model.js' | ||
4 | export * from './videos-import-in-channel-create.model.js' | ||
diff --git a/packages/models/src/videos/import/video-import-create.model.ts b/packages/models/src/videos/import/video-import-create.model.ts new file mode 100644 index 000000000..3ec0d22f3 --- /dev/null +++ b/packages/models/src/videos/import/video-import-create.model.ts | |||
@@ -0,0 +1,9 @@ | |||
1 | import { VideoUpdate } from '../video-update.model.js' | ||
2 | |||
3 | export interface VideoImportCreate extends VideoUpdate { | ||
4 | targetUrl?: string | ||
5 | magnetUri?: string | ||
6 | torrentfile?: Blob | ||
7 | |||
8 | channelId: number // Required | ||
9 | } | ||
diff --git a/packages/models/src/videos/import/video-import-state.enum.ts b/packages/models/src/videos/import/video-import-state.enum.ts new file mode 100644 index 000000000..475fdbe66 --- /dev/null +++ b/packages/models/src/videos/import/video-import-state.enum.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | export const VideoImportState = { | ||
2 | PENDING: 1, | ||
3 | SUCCESS: 2, | ||
4 | FAILED: 3, | ||
5 | REJECTED: 4, | ||
6 | CANCELLED: 5, | ||
7 | PROCESSING: 6 | ||
8 | } as const | ||
9 | |||
10 | export type VideoImportStateType = typeof VideoImportState[keyof typeof VideoImportState] | ||
diff --git a/packages/models/src/videos/import/video-import.model.ts b/packages/models/src/videos/import/video-import.model.ts new file mode 100644 index 000000000..eef23f401 --- /dev/null +++ b/packages/models/src/videos/import/video-import.model.ts | |||
@@ -0,0 +1,24 @@ | |||
1 | import { VideoConstant } from '../video-constant.model.js' | ||
2 | import { Video } from '../video.model.js' | ||
3 | import { VideoImportStateType } from './video-import-state.enum.js' | ||
4 | |||
5 | export interface VideoImport { | ||
6 | id: number | ||
7 | |||
8 | targetUrl: string | ||
9 | magnetUri: string | ||
10 | torrentName: string | ||
11 | |||
12 | createdAt: string | ||
13 | updatedAt: string | ||
14 | originallyPublishedAt?: string | ||
15 | state: VideoConstant<VideoImportStateType> | ||
16 | error?: string | ||
17 | |||
18 | video?: Video & { tags: string[] } | ||
19 | |||
20 | videoChannelSync?: { | ||
21 | id: number | ||
22 | externalChannelUrl: string | ||
23 | } | ||
24 | } | ||
diff --git a/packages/models/src/videos/import/videos-import-in-channel-create.model.ts b/packages/models/src/videos/import/videos-import-in-channel-create.model.ts new file mode 100644 index 000000000..fbfef63f8 --- /dev/null +++ b/packages/models/src/videos/import/videos-import-in-channel-create.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface VideosImportInChannelCreate { | ||
2 | externalChannelUrl: string | ||
3 | videoChannelSyncId?: number | ||
4 | } | ||
diff --git a/packages/models/src/videos/index.ts b/packages/models/src/videos/index.ts new file mode 100644 index 000000000..d131212c9 --- /dev/null +++ b/packages/models/src/videos/index.ts | |||
@@ -0,0 +1,43 @@ | |||
1 | export * from './blacklist/index.js' | ||
2 | export * from './caption/index.js' | ||
3 | export * from './change-ownership/index.js' | ||
4 | export * from './channel/index.js' | ||
5 | export * from './comment/index.js' | ||
6 | export * from './studio/index.js' | ||
7 | export * from './live/index.js' | ||
8 | export * from './file/index.js' | ||
9 | export * from './import/index.js' | ||
10 | export * from './playlist/index.js' | ||
11 | export * from './rate/index.js' | ||
12 | export * from './stats/index.js' | ||
13 | export * from './transcoding/index.js' | ||
14 | export * from './channel-sync/index.js' | ||
15 | |||
16 | export * from './nsfw-policy.type.js' | ||
17 | |||
18 | export * from './storyboard.model.js' | ||
19 | export * from './thumbnail.type.js' | ||
20 | |||
21 | export * from './video-constant.model.js' | ||
22 | export * from './video-create.model.js' | ||
23 | |||
24 | export * from './video-privacy.enum.js' | ||
25 | export * from './video-include.enum.js' | ||
26 | export * from './video-rate.type.js' | ||
27 | |||
28 | export * from './video-schedule-update.model.js' | ||
29 | export * from './video-sort-field.type.js' | ||
30 | export * from './video-state.enum.js' | ||
31 | export * from './video-storage.enum.js' | ||
32 | export * from './video-source.model.js' | ||
33 | |||
34 | export * from './video-streaming-playlist.model.js' | ||
35 | export * from './video-streaming-playlist.type.js' | ||
36 | |||
37 | export * from './video-token.model.js' | ||
38 | |||
39 | export * from './video-update.model.js' | ||
40 | export * from './video-view.model.js' | ||
41 | export * from './video.model.js' | ||
42 | export * from './video-create-result.model.js' | ||
43 | export * from './video-password.model.js' | ||
diff --git a/packages/models/src/videos/live/index.ts b/packages/models/src/videos/live/index.ts new file mode 100644 index 000000000..1763eb574 --- /dev/null +++ b/packages/models/src/videos/live/index.ts | |||
@@ -0,0 +1,8 @@ | |||
1 | export * from './live-video-create.model.js' | ||
2 | export * from './live-video-error.enum.js' | ||
3 | export * from './live-video-event-payload.model.js' | ||
4 | export * from './live-video-event.type.js' | ||
5 | export * from './live-video-latency-mode.enum.js' | ||
6 | export * from './live-video-session.model.js' | ||
7 | export * from './live-video-update.model.js' | ||
8 | export * from './live-video.model.js' | ||
diff --git a/packages/models/src/videos/live/live-video-create.model.ts b/packages/models/src/videos/live/live-video-create.model.ts new file mode 100644 index 000000000..e4e39518c --- /dev/null +++ b/packages/models/src/videos/live/live-video-create.model.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | import { VideoCreate } from '../video-create.model.js' | ||
2 | import { VideoPrivacyType } from '../video-privacy.enum.js' | ||
3 | import { LiveVideoLatencyModeType } from './live-video-latency-mode.enum.js' | ||
4 | |||
5 | export interface LiveVideoCreate extends VideoCreate { | ||
6 | permanentLive?: boolean | ||
7 | latencyMode?: LiveVideoLatencyModeType | ||
8 | |||
9 | saveReplay?: boolean | ||
10 | replaySettings?: { privacy: VideoPrivacyType } | ||
11 | } | ||
diff --git a/packages/models/src/videos/live/live-video-error.enum.ts b/packages/models/src/videos/live/live-video-error.enum.ts new file mode 100644 index 000000000..cd92a1cff --- /dev/null +++ b/packages/models/src/videos/live/live-video-error.enum.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | export const LiveVideoError = { | ||
2 | BAD_SOCKET_HEALTH: 1, | ||
3 | DURATION_EXCEEDED: 2, | ||
4 | QUOTA_EXCEEDED: 3, | ||
5 | FFMPEG_ERROR: 4, | ||
6 | BLACKLISTED: 5, | ||
7 | RUNNER_JOB_ERROR: 6, | ||
8 | RUNNER_JOB_CANCEL: 7 | ||
9 | } as const | ||
10 | |||
11 | export type LiveVideoErrorType = typeof LiveVideoError[keyof typeof LiveVideoError] | ||
diff --git a/packages/models/src/videos/live/live-video-event-payload.model.ts b/packages/models/src/videos/live/live-video-event-payload.model.ts new file mode 100644 index 000000000..507f8d153 --- /dev/null +++ b/packages/models/src/videos/live/live-video-event-payload.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { VideoStateType } from '../video-state.enum.js' | ||
2 | |||
3 | export interface LiveVideoEventPayload { | ||
4 | state?: VideoStateType | ||
5 | |||
6 | viewers?: number | ||
7 | } | ||
diff --git a/packages/models/src/videos/live/live-video-event.type.ts b/packages/models/src/videos/live/live-video-event.type.ts new file mode 100644 index 000000000..50f794561 --- /dev/null +++ b/packages/models/src/videos/live/live-video-event.type.ts | |||
@@ -0,0 +1 @@ | |||
export type LiveVideoEventType = 'state-change' | 'views-change' | |||
diff --git a/packages/models/src/videos/live/live-video-latency-mode.enum.ts b/packages/models/src/videos/live/live-video-latency-mode.enum.ts new file mode 100644 index 000000000..6fd8fe8e9 --- /dev/null +++ b/packages/models/src/videos/live/live-video-latency-mode.enum.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export const LiveVideoLatencyMode = { | ||
2 | DEFAULT: 1, | ||
3 | HIGH_LATENCY: 2, | ||
4 | SMALL_LATENCY: 3 | ||
5 | } as const | ||
6 | |||
7 | export type LiveVideoLatencyModeType = typeof LiveVideoLatencyMode[keyof typeof LiveVideoLatencyMode] | ||
diff --git a/packages/models/src/videos/live/live-video-session.model.ts b/packages/models/src/videos/live/live-video-session.model.ts new file mode 100644 index 000000000..8d45bc86a --- /dev/null +++ b/packages/models/src/videos/live/live-video-session.model.ts | |||
@@ -0,0 +1,22 @@ | |||
1 | import { VideoPrivacyType } from '../video-privacy.enum.js' | ||
2 | import { LiveVideoErrorType } from './live-video-error.enum.js' | ||
3 | |||
4 | export interface LiveVideoSession { | ||
5 | id: number | ||
6 | |||
7 | startDate: string | ||
8 | endDate: string | ||
9 | |||
10 | error: LiveVideoErrorType | ||
11 | |||
12 | saveReplay: boolean | ||
13 | endingProcessed: boolean | ||
14 | |||
15 | replaySettings?: { privacy: VideoPrivacyType } | ||
16 | |||
17 | replayVideo: { | ||
18 | id: number | ||
19 | uuid: string | ||
20 | shortUUID: string | ||
21 | } | ||
22 | } | ||
diff --git a/packages/models/src/videos/live/live-video-update.model.ts b/packages/models/src/videos/live/live-video-update.model.ts new file mode 100644 index 000000000..b4d91e447 --- /dev/null +++ b/packages/models/src/videos/live/live-video-update.model.ts | |||
@@ -0,0 +1,9 @@ | |||
1 | import { VideoPrivacyType } from '../video-privacy.enum.js' | ||
2 | import { LiveVideoLatencyModeType } from './live-video-latency-mode.enum.js' | ||
3 | |||
4 | export interface LiveVideoUpdate { | ||
5 | permanentLive?: boolean | ||
6 | saveReplay?: boolean | ||
7 | replaySettings?: { privacy: VideoPrivacyType } | ||
8 | latencyMode?: LiveVideoLatencyModeType | ||
9 | } | ||
diff --git a/packages/models/src/videos/live/live-video.model.ts b/packages/models/src/videos/live/live-video.model.ts new file mode 100644 index 000000000..3e91f677c --- /dev/null +++ b/packages/models/src/videos/live/live-video.model.ts | |||
@@ -0,0 +1,14 @@ | |||
1 | import { VideoPrivacyType } from '../video-privacy.enum.js' | ||
2 | import { LiveVideoLatencyModeType } from './live-video-latency-mode.enum.js' | ||
3 | |||
4 | export interface LiveVideo { | ||
5 | // If owner | ||
6 | rtmpUrl?: string | ||
7 | rtmpsUrl?: string | ||
8 | streamKey?: string | ||
9 | |||
10 | saveReplay: boolean | ||
11 | replaySettings?: { privacy: VideoPrivacyType } | ||
12 | permanentLive: boolean | ||
13 | latencyMode: LiveVideoLatencyModeType | ||
14 | } | ||
diff --git a/packages/models/src/videos/nsfw-policy.type.ts b/packages/models/src/videos/nsfw-policy.type.ts new file mode 100644 index 000000000..dc0032a14 --- /dev/null +++ b/packages/models/src/videos/nsfw-policy.type.ts | |||
@@ -0,0 +1 @@ | |||
export type NSFWPolicyType = 'do_not_list' | 'blur' | 'display' | |||
diff --git a/packages/models/src/videos/playlist/index.ts b/packages/models/src/videos/playlist/index.ts new file mode 100644 index 000000000..0e139657a --- /dev/null +++ b/packages/models/src/videos/playlist/index.ts | |||
@@ -0,0 +1,12 @@ | |||
1 | export * from './video-exist-in-playlist.model.js' | ||
2 | export * from './video-playlist-create-result.model.js' | ||
3 | export * from './video-playlist-create.model.js' | ||
4 | export * from './video-playlist-element-create-result.model.js' | ||
5 | export * from './video-playlist-element-create.model.js' | ||
6 | export * from './video-playlist-element-update.model.js' | ||
7 | export * from './video-playlist-element.model.js' | ||
8 | export * from './video-playlist-privacy.model.js' | ||
9 | export * from './video-playlist-reorder.model.js' | ||
10 | export * from './video-playlist-type.model.js' | ||
11 | export * from './video-playlist-update.model.js' | ||
12 | export * from './video-playlist.model.js' | ||
diff --git a/packages/models/src/videos/playlist/video-exist-in-playlist.model.ts b/packages/models/src/videos/playlist/video-exist-in-playlist.model.ts new file mode 100644 index 000000000..6d06c0f4d --- /dev/null +++ b/packages/models/src/videos/playlist/video-exist-in-playlist.model.ts | |||
@@ -0,0 +1,18 @@ | |||
1 | export type VideosExistInPlaylists = { | ||
2 | [videoId: number]: VideoExistInPlaylist[] | ||
3 | } | ||
4 | export type CachedVideosExistInPlaylists = { | ||
5 | [videoId: number]: CachedVideoExistInPlaylist[] | ||
6 | } | ||
7 | |||
8 | export type CachedVideoExistInPlaylist = { | ||
9 | playlistElementId: number | ||
10 | playlistId: number | ||
11 | startTimestamp?: number | ||
12 | stopTimestamp?: number | ||
13 | } | ||
14 | |||
15 | export type VideoExistInPlaylist = CachedVideoExistInPlaylist & { | ||
16 | playlistDisplayName: string | ||
17 | playlistShortUUID: string | ||
18 | } | ||
diff --git a/packages/models/src/videos/playlist/video-playlist-create-result.model.ts b/packages/models/src/videos/playlist/video-playlist-create-result.model.ts new file mode 100644 index 000000000..cd9b170ae --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist-create-result.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface VideoPlaylistCreateResult { | ||
2 | id: number | ||
3 | uuid: string | ||
4 | shortUUID: string | ||
5 | } | ||
diff --git a/packages/models/src/videos/playlist/video-playlist-create.model.ts b/packages/models/src/videos/playlist/video-playlist-create.model.ts new file mode 100644 index 000000000..f9dd1e0d1 --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist-create.model.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | import { VideoPlaylistPrivacyType } from './video-playlist-privacy.model.js' | ||
2 | |||
3 | export interface VideoPlaylistCreate { | ||
4 | displayName: string | ||
5 | privacy: VideoPlaylistPrivacyType | ||
6 | |||
7 | description?: string | ||
8 | videoChannelId?: number | ||
9 | |||
10 | thumbnailfile?: any | ||
11 | } | ||
diff --git a/packages/models/src/videos/playlist/video-playlist-element-create-result.model.ts b/packages/models/src/videos/playlist/video-playlist-element-create-result.model.ts new file mode 100644 index 000000000..dc475e7d8 --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist-element-create-result.model.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export interface VideoPlaylistElementCreateResult { | ||
2 | id: number | ||
3 | } | ||
diff --git a/packages/models/src/videos/playlist/video-playlist-element-create.model.ts b/packages/models/src/videos/playlist/video-playlist-element-create.model.ts new file mode 100644 index 000000000..c31702892 --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist-element-create.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export interface VideoPlaylistElementCreate { | ||
2 | videoId: number | ||
3 | |||
4 | startTimestamp?: number | ||
5 | stopTimestamp?: number | ||
6 | } | ||
diff --git a/packages/models/src/videos/playlist/video-playlist-element-update.model.ts b/packages/models/src/videos/playlist/video-playlist-element-update.model.ts new file mode 100644 index 000000000..15a30fbdc --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist-element-update.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface VideoPlaylistElementUpdate { | ||
2 | startTimestamp?: number | ||
3 | stopTimestamp?: number | ||
4 | } | ||
diff --git a/packages/models/src/videos/playlist/video-playlist-element.model.ts b/packages/models/src/videos/playlist/video-playlist-element.model.ts new file mode 100644 index 000000000..a4711f919 --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist-element.model.ts | |||
@@ -0,0 +1,21 @@ | |||
1 | import { Video } from '../video.model.js' | ||
2 | |||
3 | export const VideoPlaylistElementType = { | ||
4 | REGULAR: 0, | ||
5 | DELETED: 1, | ||
6 | PRIVATE: 2, | ||
7 | UNAVAILABLE: 3 // Blacklisted, blocked by the user/instance, NSFW... | ||
8 | } as const | ||
9 | |||
10 | export type VideoPlaylistElementType_Type = typeof VideoPlaylistElementType[keyof typeof VideoPlaylistElementType] | ||
11 | |||
12 | export interface VideoPlaylistElement { | ||
13 | id: number | ||
14 | position: number | ||
15 | startTimestamp: number | ||
16 | stopTimestamp: number | ||
17 | |||
18 | type: VideoPlaylistElementType_Type | ||
19 | |||
20 | video?: Video | ||
21 | } | ||
diff --git a/packages/models/src/videos/playlist/video-playlist-privacy.model.ts b/packages/models/src/videos/playlist/video-playlist-privacy.model.ts new file mode 100644 index 000000000..23f6a1a16 --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist-privacy.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export const VideoPlaylistPrivacy = { | ||
2 | PUBLIC: 1, | ||
3 | UNLISTED: 2, | ||
4 | PRIVATE: 3 | ||
5 | } as const | ||
6 | |||
7 | export type VideoPlaylistPrivacyType = typeof VideoPlaylistPrivacy[keyof typeof VideoPlaylistPrivacy] | ||
diff --git a/packages/models/src/videos/playlist/video-playlist-reorder.model.ts b/packages/models/src/videos/playlist/video-playlist-reorder.model.ts new file mode 100644 index 000000000..63ec714c5 --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist-reorder.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface VideoPlaylistReorder { | ||
2 | startPosition: number | ||
3 | insertAfterPosition: number | ||
4 | reorderLength?: number | ||
5 | } | ||
diff --git a/packages/models/src/videos/playlist/video-playlist-type.model.ts b/packages/models/src/videos/playlist/video-playlist-type.model.ts new file mode 100644 index 000000000..183439f98 --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist-type.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export const VideoPlaylistType = { | ||
2 | REGULAR: 1, | ||
3 | WATCH_LATER: 2 | ||
4 | } as const | ||
5 | |||
6 | export type VideoPlaylistType_Type = typeof VideoPlaylistType[keyof typeof VideoPlaylistType] | ||
diff --git a/packages/models/src/videos/playlist/video-playlist-update.model.ts b/packages/models/src/videos/playlist/video-playlist-update.model.ts new file mode 100644 index 000000000..ed536367e --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist-update.model.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | import { VideoPlaylistPrivacyType } from './video-playlist-privacy.model.js' | ||
2 | |||
3 | export interface VideoPlaylistUpdate { | ||
4 | displayName?: string | ||
5 | privacy?: VideoPlaylistPrivacyType | ||
6 | |||
7 | description?: string | ||
8 | videoChannelId?: number | ||
9 | thumbnailfile?: any | ||
10 | } | ||
diff --git a/packages/models/src/videos/playlist/video-playlist.model.ts b/packages/models/src/videos/playlist/video-playlist.model.ts new file mode 100644 index 000000000..4261aac25 --- /dev/null +++ b/packages/models/src/videos/playlist/video-playlist.model.ts | |||
@@ -0,0 +1,35 @@ | |||
1 | import { AccountSummary } from '../../actors/index.js' | ||
2 | import { VideoChannelSummary } from '../channel/index.js' | ||
3 | import { VideoConstant } from '../video-constant.model.js' | ||
4 | import { VideoPlaylistPrivacyType } from './video-playlist-privacy.model.js' | ||
5 | import { VideoPlaylistType_Type } from './video-playlist-type.model.js' | ||
6 | |||
7 | export interface VideoPlaylist { | ||
8 | id: number | ||
9 | uuid: string | ||
10 | shortUUID: string | ||
11 | |||
12 | isLocal: boolean | ||
13 | |||
14 | url: string | ||
15 | |||
16 | displayName: string | ||
17 | description: string | ||
18 | privacy: VideoConstant<VideoPlaylistPrivacyType> | ||
19 | |||
20 | thumbnailPath: string | ||
21 | thumbnailUrl?: string | ||
22 | |||
23 | videosLength: number | ||
24 | |||
25 | type: VideoConstant<VideoPlaylistType_Type> | ||
26 | |||
27 | embedPath: string | ||
28 | embedUrl?: string | ||
29 | |||
30 | createdAt: Date | string | ||
31 | updatedAt: Date | string | ||
32 | |||
33 | ownerAccount: AccountSummary | ||
34 | videoChannel?: VideoChannelSummary | ||
35 | } | ||
diff --git a/packages/models/src/videos/rate/account-video-rate.model.ts b/packages/models/src/videos/rate/account-video-rate.model.ts new file mode 100644 index 000000000..d19ccdbdd --- /dev/null +++ b/packages/models/src/videos/rate/account-video-rate.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { UserVideoRateType } from './user-video-rate.type.js' | ||
2 | import { Video } from '../video.model.js' | ||
3 | |||
4 | export interface AccountVideoRate { | ||
5 | video: Video | ||
6 | rating: UserVideoRateType | ||
7 | } | ||
diff --git a/packages/models/src/videos/rate/index.ts b/packages/models/src/videos/rate/index.ts new file mode 100644 index 000000000..ecbe3523d --- /dev/null +++ b/packages/models/src/videos/rate/index.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | |||
2 | export * from './user-video-rate-update.model.js' | ||
3 | export * from './user-video-rate.model.js' | ||
4 | export * from './account-video-rate.model.js' | ||
5 | export * from './user-video-rate.type.js' | ||
diff --git a/packages/models/src/videos/rate/user-video-rate-update.model.ts b/packages/models/src/videos/rate/user-video-rate-update.model.ts new file mode 100644 index 000000000..8ee1e78ca --- /dev/null +++ b/packages/models/src/videos/rate/user-video-rate-update.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | import { UserVideoRateType } from './user-video-rate.type.js' | ||
2 | |||
3 | export interface UserVideoRateUpdate { | ||
4 | rating: UserVideoRateType | ||
5 | } | ||
diff --git a/packages/models/src/videos/rate/user-video-rate.model.ts b/packages/models/src/videos/rate/user-video-rate.model.ts new file mode 100644 index 000000000..344cf9a68 --- /dev/null +++ b/packages/models/src/videos/rate/user-video-rate.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | import { UserVideoRateType } from './user-video-rate.type.js' | ||
2 | |||
3 | export interface UserVideoRate { | ||
4 | videoId: number | ||
5 | rating: UserVideoRateType | ||
6 | } | ||
diff --git a/packages/models/src/videos/rate/user-video-rate.type.ts b/packages/models/src/videos/rate/user-video-rate.type.ts new file mode 100644 index 000000000..a4d9c7e39 --- /dev/null +++ b/packages/models/src/videos/rate/user-video-rate.type.ts | |||
@@ -0,0 +1 @@ | |||
export type UserVideoRateType = 'like' | 'dislike' | 'none' | |||
diff --git a/packages/models/src/videos/stats/index.ts b/packages/models/src/videos/stats/index.ts new file mode 100644 index 000000000..7187cac26 --- /dev/null +++ b/packages/models/src/videos/stats/index.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export * from './video-stats-overall-query.model.js' | ||
2 | export * from './video-stats-overall.model.js' | ||
3 | export * from './video-stats-retention.model.js' | ||
4 | export * from './video-stats-timeserie-query.model.js' | ||
5 | export * from './video-stats-timeserie-metric.type.js' | ||
6 | export * from './video-stats-timeserie.model.js' | ||
diff --git a/packages/models/src/videos/stats/video-stats-overall-query.model.ts b/packages/models/src/videos/stats/video-stats-overall-query.model.ts new file mode 100644 index 000000000..6b4c2164f --- /dev/null +++ b/packages/models/src/videos/stats/video-stats-overall-query.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface VideoStatsOverallQuery { | ||
2 | startDate?: string | ||
3 | endDate?: string | ||
4 | } | ||
diff --git a/packages/models/src/videos/stats/video-stats-overall.model.ts b/packages/models/src/videos/stats/video-stats-overall.model.ts new file mode 100644 index 000000000..54b57798f --- /dev/null +++ b/packages/models/src/videos/stats/video-stats-overall.model.ts | |||
@@ -0,0 +1,14 @@ | |||
1 | export interface VideoStatsOverall { | ||
2 | averageWatchTime: number | ||
3 | totalWatchTime: number | ||
4 | |||
5 | totalViewers: number | ||
6 | |||
7 | viewersPeak: number | ||
8 | viewersPeakDate: string | ||
9 | |||
10 | countries: { | ||
11 | isoCode: string | ||
12 | viewers: number | ||
13 | }[] | ||
14 | } | ||
diff --git a/packages/models/src/videos/stats/video-stats-retention.model.ts b/packages/models/src/videos/stats/video-stats-retention.model.ts new file mode 100644 index 000000000..e494888ed --- /dev/null +++ b/packages/models/src/videos/stats/video-stats-retention.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export interface VideoStatsRetention { | ||
2 | data: { | ||
3 | second: number | ||
4 | retentionPercent: number | ||
5 | }[] | ||
6 | } | ||
diff --git a/packages/models/src/videos/stats/video-stats-timeserie-metric.type.ts b/packages/models/src/videos/stats/video-stats-timeserie-metric.type.ts new file mode 100644 index 000000000..fc268d083 --- /dev/null +++ b/packages/models/src/videos/stats/video-stats-timeserie-metric.type.ts | |||
@@ -0,0 +1 @@ | |||
export type VideoStatsTimeserieMetric = 'viewers' | 'aggregateWatchTime' | |||
diff --git a/packages/models/src/videos/stats/video-stats-timeserie-query.model.ts b/packages/models/src/videos/stats/video-stats-timeserie-query.model.ts new file mode 100644 index 000000000..f3a8430e1 --- /dev/null +++ b/packages/models/src/videos/stats/video-stats-timeserie-query.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface VideoStatsTimeserieQuery { | ||
2 | startDate?: string | ||
3 | endDate?: string | ||
4 | } | ||
diff --git a/packages/models/src/videos/stats/video-stats-timeserie.model.ts b/packages/models/src/videos/stats/video-stats-timeserie.model.ts new file mode 100644 index 000000000..4a0e208df --- /dev/null +++ b/packages/models/src/videos/stats/video-stats-timeserie.model.ts | |||
@@ -0,0 +1,8 @@ | |||
1 | export interface VideoStatsTimeserie { | ||
2 | groupInterval: string | ||
3 | |||
4 | data: { | ||
5 | date: string | ||
6 | value: number | ||
7 | }[] | ||
8 | } | ||
diff --git a/packages/models/src/videos/storyboard.model.ts b/packages/models/src/videos/storyboard.model.ts new file mode 100644 index 000000000..c92c81f09 --- /dev/null +++ b/packages/models/src/videos/storyboard.model.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | export interface Storyboard { | ||
2 | storyboardPath: string | ||
3 | |||
4 | totalHeight: number | ||
5 | totalWidth: number | ||
6 | |||
7 | spriteHeight: number | ||
8 | spriteWidth: number | ||
9 | |||
10 | spriteDuration: number | ||
11 | } | ||
diff --git a/packages/models/src/videos/studio/index.ts b/packages/models/src/videos/studio/index.ts new file mode 100644 index 000000000..0d8ad3227 --- /dev/null +++ b/packages/models/src/videos/studio/index.ts | |||
@@ -0,0 +1 @@ | |||
export * from './video-studio-create-edit.model.js' | |||
diff --git a/packages/models/src/videos/studio/video-studio-create-edit.model.ts b/packages/models/src/videos/studio/video-studio-create-edit.model.ts new file mode 100644 index 000000000..5e8296dc9 --- /dev/null +++ b/packages/models/src/videos/studio/video-studio-create-edit.model.ts | |||
@@ -0,0 +1,60 @@ | |||
1 | export interface VideoStudioCreateEdition { | ||
2 | tasks: VideoStudioTask[] | ||
3 | } | ||
4 | |||
5 | export type VideoStudioTask = | ||
6 | VideoStudioTaskCut | | ||
7 | VideoStudioTaskIntro | | ||
8 | VideoStudioTaskOutro | | ||
9 | VideoStudioTaskWatermark | ||
10 | |||
11 | export interface VideoStudioTaskCut { | ||
12 | name: 'cut' | ||
13 | |||
14 | options: { | ||
15 | start?: number | ||
16 | end?: number | ||
17 | } | ||
18 | } | ||
19 | |||
20 | export interface VideoStudioTaskIntro { | ||
21 | name: 'add-intro' | ||
22 | |||
23 | options: { | ||
24 | file: Blob | string | ||
25 | } | ||
26 | } | ||
27 | |||
28 | export interface VideoStudioTaskOutro { | ||
29 | name: 'add-outro' | ||
30 | |||
31 | options: { | ||
32 | file: Blob | string | ||
33 | } | ||
34 | } | ||
35 | |||
36 | export interface VideoStudioTaskWatermark { | ||
37 | name: 'add-watermark' | ||
38 | |||
39 | options: { | ||
40 | file: Blob | string | ||
41 | } | ||
42 | } | ||
43 | |||
44 | // --------------------------------------------------------------------------- | ||
45 | |||
46 | export function isVideoStudioTaskIntro (v: VideoStudioTask): v is VideoStudioTaskIntro { | ||
47 | return v.name === 'add-intro' | ||
48 | } | ||
49 | |||
50 | export function isVideoStudioTaskOutro (v: VideoStudioTask): v is VideoStudioTaskOutro { | ||
51 | return v.name === 'add-outro' | ||
52 | } | ||
53 | |||
54 | export function isVideoStudioTaskWatermark (v: VideoStudioTask): v is VideoStudioTaskWatermark { | ||
55 | return v.name === 'add-watermark' | ||
56 | } | ||
57 | |||
58 | export function hasVideoStudioTaskFile (v: VideoStudioTask): v is VideoStudioTaskIntro | VideoStudioTaskOutro | VideoStudioTaskWatermark { | ||
59 | return isVideoStudioTaskIntro(v) || isVideoStudioTaskOutro(v) || isVideoStudioTaskWatermark(v) | ||
60 | } | ||
diff --git a/packages/models/src/videos/thumbnail.type.ts b/packages/models/src/videos/thumbnail.type.ts new file mode 100644 index 000000000..0cb7483ec --- /dev/null +++ b/packages/models/src/videos/thumbnail.type.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export const ThumbnailType = { | ||
2 | MINIATURE: 1, | ||
3 | PREVIEW: 2 | ||
4 | } as const | ||
5 | |||
6 | export type ThumbnailType_Type = typeof ThumbnailType[keyof typeof ThumbnailType] | ||
diff --git a/packages/models/src/videos/transcoding/index.ts b/packages/models/src/videos/transcoding/index.ts new file mode 100644 index 000000000..e1d931bd5 --- /dev/null +++ b/packages/models/src/videos/transcoding/index.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export * from './video-transcoding-create.model.js' | ||
2 | export * from './video-transcoding-fps.model.js' | ||
3 | export * from './video-transcoding.model.js' | ||
diff --git a/packages/models/src/videos/transcoding/video-transcoding-create.model.ts b/packages/models/src/videos/transcoding/video-transcoding-create.model.ts new file mode 100644 index 000000000..6c2dbefa6 --- /dev/null +++ b/packages/models/src/videos/transcoding/video-transcoding-create.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface VideoTranscodingCreate { | ||
2 | transcodingType: 'hls' | 'webtorrent' | 'web-video' // TODO: remove webtorrent in v7 | ||
3 | |||
4 | forceTranscoding?: boolean // Default false | ||
5 | } | ||
diff --git a/packages/models/src/videos/transcoding/video-transcoding-fps.model.ts b/packages/models/src/videos/transcoding/video-transcoding-fps.model.ts new file mode 100644 index 000000000..9a330ac94 --- /dev/null +++ b/packages/models/src/videos/transcoding/video-transcoding-fps.model.ts | |||
@@ -0,0 +1,9 @@ | |||
1 | export type VideoTranscodingFPS = { | ||
2 | MIN: number | ||
3 | STANDARD: number[] | ||
4 | HD_STANDARD: number[] | ||
5 | AUDIO_MERGE: number | ||
6 | AVERAGE: number | ||
7 | MAX: number | ||
8 | KEEP_ORIGIN_FPS_RESOLUTION_MIN: number | ||
9 | } | ||
diff --git a/packages/models/src/videos/transcoding/video-transcoding.model.ts b/packages/models/src/videos/transcoding/video-transcoding.model.ts new file mode 100644 index 000000000..e2c2a56e5 --- /dev/null +++ b/packages/models/src/videos/transcoding/video-transcoding.model.ts | |||
@@ -0,0 +1,65 @@ | |||
1 | // Types used by plugins and ffmpeg-utils | ||
2 | |||
3 | export type EncoderOptionsBuilderParams = { | ||
4 | input: string | ||
5 | |||
6 | resolution: number | ||
7 | |||
8 | // If PeerTube applies a filter, transcoding profile must not copy input stream | ||
9 | canCopyAudio: boolean | ||
10 | canCopyVideo: boolean | ||
11 | |||
12 | fps: number | ||
13 | |||
14 | // Could be undefined if we could not get input bitrate (some RTMP streams for example) | ||
15 | inputBitrate: number | ||
16 | inputRatio: number | ||
17 | |||
18 | // For lives | ||
19 | streamNum?: number | ||
20 | } | ||
21 | |||
22 | export type EncoderOptionsBuilder = (params: EncoderOptionsBuilderParams) => Promise<EncoderOptions> | EncoderOptions | ||
23 | |||
24 | export interface EncoderOptions { | ||
25 | copy?: boolean // Copy stream? Default to false | ||
26 | |||
27 | scaleFilter?: { | ||
28 | name: string | ||
29 | } | ||
30 | |||
31 | inputOptions?: string[] | ||
32 | outputOptions?: string[] | ||
33 | } | ||
34 | |||
35 | // All our encoders | ||
36 | |||
37 | export interface EncoderProfile <T> { | ||
38 | [ profile: string ]: T | ||
39 | |||
40 | default: T | ||
41 | } | ||
42 | |||
43 | export type AvailableEncoders = { | ||
44 | available: { | ||
45 | live: { | ||
46 | [ encoder: string ]: EncoderProfile<EncoderOptionsBuilder> | ||
47 | } | ||
48 | |||
49 | vod: { | ||
50 | [ encoder: string ]: EncoderProfile<EncoderOptionsBuilder> | ||
51 | } | ||
52 | } | ||
53 | |||
54 | encodersToTry: { | ||
55 | vod: { | ||
56 | video: string[] | ||
57 | audio: string[] | ||
58 | } | ||
59 | |||
60 | live: { | ||
61 | video: string[] | ||
62 | audio: string[] | ||
63 | } | ||
64 | } | ||
65 | } | ||
diff --git a/packages/models/src/videos/video-constant.model.ts b/packages/models/src/videos/video-constant.model.ts new file mode 100644 index 000000000..353a29535 --- /dev/null +++ b/packages/models/src/videos/video-constant.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface VideoConstant<T> { | ||
2 | id: T | ||
3 | label: string | ||
4 | description?: string | ||
5 | } | ||
diff --git a/packages/models/src/videos/video-create-result.model.ts b/packages/models/src/videos/video-create-result.model.ts new file mode 100644 index 000000000..a9f8e25a0 --- /dev/null +++ b/packages/models/src/videos/video-create-result.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export interface VideoCreateResult { | ||
2 | id: number | ||
3 | uuid: string | ||
4 | shortUUID: string | ||
5 | } | ||
diff --git a/packages/models/src/videos/video-create.model.ts b/packages/models/src/videos/video-create.model.ts new file mode 100644 index 000000000..472201211 --- /dev/null +++ b/packages/models/src/videos/video-create.model.ts | |||
@@ -0,0 +1,25 @@ | |||
1 | import { VideoPrivacyType } from './video-privacy.enum.js' | ||
2 | import { VideoScheduleUpdate } from './video-schedule-update.model.js' | ||
3 | |||
4 | export interface VideoCreate { | ||
5 | name: string | ||
6 | channelId: number | ||
7 | |||
8 | category?: number | ||
9 | licence?: number | ||
10 | language?: string | ||
11 | description?: string | ||
12 | support?: string | ||
13 | nsfw?: boolean | ||
14 | waitTranscoding?: boolean | ||
15 | tags?: string[] | ||
16 | commentsEnabled?: boolean | ||
17 | downloadEnabled?: boolean | ||
18 | privacy: VideoPrivacyType | ||
19 | scheduleUpdate?: VideoScheduleUpdate | ||
20 | originallyPublishedAt?: Date | string | ||
21 | videoPasswords?: string[] | ||
22 | |||
23 | thumbnailfile?: Blob | string | ||
24 | previewfile?: Blob | string | ||
25 | } | ||
diff --git a/packages/models/src/videos/video-include.enum.ts b/packages/models/src/videos/video-include.enum.ts new file mode 100644 index 000000000..7d88a6890 --- /dev/null +++ b/packages/models/src/videos/video-include.enum.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | export const VideoInclude = { | ||
2 | NONE: 0, | ||
3 | NOT_PUBLISHED_STATE: 1 << 0, | ||
4 | BLACKLISTED: 1 << 1, | ||
5 | BLOCKED_OWNER: 1 << 2, | ||
6 | FILES: 1 << 3, | ||
7 | CAPTIONS: 1 << 4 | ||
8 | } as const | ||
9 | |||
10 | export type VideoIncludeType = typeof VideoInclude[keyof typeof VideoInclude] | ||
diff --git a/packages/models/src/videos/video-password.model.ts b/packages/models/src/videos/video-password.model.ts new file mode 100644 index 000000000..c0280b9b9 --- /dev/null +++ b/packages/models/src/videos/video-password.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export interface VideoPassword { | ||
2 | id: number | ||
3 | password: string | ||
4 | videoId: number | ||
5 | createdAt: Date | string | ||
6 | updatedAt: Date | string | ||
7 | } | ||
diff --git a/packages/models/src/videos/video-privacy.enum.ts b/packages/models/src/videos/video-privacy.enum.ts new file mode 100644 index 000000000..cbcc91b3f --- /dev/null +++ b/packages/models/src/videos/video-privacy.enum.ts | |||
@@ -0,0 +1,9 @@ | |||
1 | export const VideoPrivacy = { | ||
2 | PUBLIC: 1, | ||
3 | UNLISTED: 2, | ||
4 | PRIVATE: 3, | ||
5 | INTERNAL: 4, | ||
6 | PASSWORD_PROTECTED: 5 | ||
7 | } as const | ||
8 | |||
9 | export type VideoPrivacyType = typeof VideoPrivacy[keyof typeof VideoPrivacy] | ||
diff --git a/packages/models/src/videos/video-rate.type.ts b/packages/models/src/videos/video-rate.type.ts new file mode 100644 index 000000000..d48774a4b --- /dev/null +++ b/packages/models/src/videos/video-rate.type.ts | |||
@@ -0,0 +1 @@ | |||
export type VideoRateType = 'like' | 'dislike' | |||
diff --git a/packages/models/src/videos/video-schedule-update.model.ts b/packages/models/src/videos/video-schedule-update.model.ts new file mode 100644 index 000000000..2e6a5551d --- /dev/null +++ b/packages/models/src/videos/video-schedule-update.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { VideoPrivacy } from './video-privacy.enum.js' | ||
2 | |||
3 | export interface VideoScheduleUpdate { | ||
4 | updateAt: Date | string | ||
5 | // Cannot schedule an update to PRIVATE | ||
6 | privacy?: typeof VideoPrivacy.PUBLIC | typeof VideoPrivacy.UNLISTED | typeof VideoPrivacy.INTERNAL | ||
7 | } | ||
diff --git a/packages/models/src/videos/video-sort-field.type.ts b/packages/models/src/videos/video-sort-field.type.ts new file mode 100644 index 000000000..7fa07fa73 --- /dev/null +++ b/packages/models/src/videos/video-sort-field.type.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | export type VideoSortField = | ||
2 | 'name' | '-name' | | ||
3 | 'duration' | '-duration' | | ||
4 | 'publishedAt' | '-publishedAt' | | ||
5 | 'originallyPublishedAt' | '-originallyPublishedAt' | | ||
6 | 'createdAt' | '-createdAt' | | ||
7 | 'views' | '-views' | | ||
8 | 'likes' | '-likes' | | ||
9 | |||
10 | // trending sorts | ||
11 | 'trending' | '-trending' | | ||
12 | 'hot' | '-hot' | | ||
13 | 'best' | '-best' | ||
diff --git a/packages/models/src/videos/video-source.model.ts b/packages/models/src/videos/video-source.model.ts new file mode 100644 index 000000000..bf4ad2453 --- /dev/null +++ b/packages/models/src/videos/video-source.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export interface VideoSource { | ||
2 | filename: string | ||
3 | createdAt: string | Date | ||
4 | } | ||
diff --git a/packages/models/src/videos/video-state.enum.ts b/packages/models/src/videos/video-state.enum.ts new file mode 100644 index 000000000..ae7c6a0c4 --- /dev/null +++ b/packages/models/src/videos/video-state.enum.ts | |||
@@ -0,0 +1,13 @@ | |||
1 | export const VideoState = { | ||
2 | PUBLISHED: 1, | ||
3 | TO_TRANSCODE: 2, | ||
4 | TO_IMPORT: 3, | ||
5 | WAITING_FOR_LIVE: 4, | ||
6 | LIVE_ENDED: 5, | ||
7 | TO_MOVE_TO_EXTERNAL_STORAGE: 6, | ||
8 | TRANSCODING_FAILED: 7, | ||
9 | TO_MOVE_TO_EXTERNAL_STORAGE_FAILED: 8, | ||
10 | TO_EDIT: 9 | ||
11 | } as const | ||
12 | |||
13 | export type VideoStateType = typeof VideoState[keyof typeof VideoState] | ||
diff --git a/packages/models/src/videos/video-storage.enum.ts b/packages/models/src/videos/video-storage.enum.ts new file mode 100644 index 000000000..de5c92e0d --- /dev/null +++ b/packages/models/src/videos/video-storage.enum.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export const VideoStorage = { | ||
2 | FILE_SYSTEM: 0, | ||
3 | OBJECT_STORAGE: 1 | ||
4 | } as const | ||
5 | |||
6 | export type VideoStorageType = typeof VideoStorage[keyof typeof VideoStorage] | ||
diff --git a/packages/models/src/videos/video-streaming-playlist.model.ts b/packages/models/src/videos/video-streaming-playlist.model.ts new file mode 100644 index 000000000..80aa70e3c --- /dev/null +++ b/packages/models/src/videos/video-streaming-playlist.model.ts | |||
@@ -0,0 +1,15 @@ | |||
1 | import { VideoFile } from './file/index.js' | ||
2 | import { VideoStreamingPlaylistType_Type } from './video-streaming-playlist.type.js' | ||
3 | |||
4 | export interface VideoStreamingPlaylist { | ||
5 | id: number | ||
6 | type: VideoStreamingPlaylistType_Type | ||
7 | playlistUrl: string | ||
8 | segmentsSha256Url: string | ||
9 | |||
10 | redundancies: { | ||
11 | baseUrl: string | ||
12 | }[] | ||
13 | |||
14 | files: VideoFile[] | ||
15 | } | ||
diff --git a/packages/models/src/videos/video-streaming-playlist.type.ts b/packages/models/src/videos/video-streaming-playlist.type.ts new file mode 100644 index 000000000..07a2c207f --- /dev/null +++ b/packages/models/src/videos/video-streaming-playlist.type.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export const VideoStreamingPlaylistType = { | ||
2 | HLS: 1 | ||
3 | } as const | ||
4 | |||
5 | export type VideoStreamingPlaylistType_Type = typeof VideoStreamingPlaylistType[keyof typeof VideoStreamingPlaylistType] | ||
diff --git a/packages/models/src/videos/video-token.model.ts b/packages/models/src/videos/video-token.model.ts new file mode 100644 index 000000000..aefea565f --- /dev/null +++ b/packages/models/src/videos/video-token.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export interface VideoToken { | ||
2 | files: { | ||
3 | token: string | ||
4 | expires: string | Date | ||
5 | } | ||
6 | } | ||
diff --git a/packages/models/src/videos/video-update.model.ts b/packages/models/src/videos/video-update.model.ts new file mode 100644 index 000000000..8af298160 --- /dev/null +++ b/packages/models/src/videos/video-update.model.ts | |||
@@ -0,0 +1,25 @@ | |||
1 | import { VideoPrivacyType } from './video-privacy.enum.js' | ||
2 | import { VideoScheduleUpdate } from './video-schedule-update.model.js' | ||
3 | |||
4 | export interface VideoUpdate { | ||
5 | name?: string | ||
6 | category?: number | ||
7 | licence?: number | ||
8 | language?: string | ||
9 | description?: string | ||
10 | support?: string | ||
11 | privacy?: VideoPrivacyType | ||
12 | tags?: string[] | ||
13 | commentsEnabled?: boolean | ||
14 | downloadEnabled?: boolean | ||
15 | nsfw?: boolean | ||
16 | waitTranscoding?: boolean | ||
17 | channelId?: number | ||
18 | thumbnailfile?: Blob | ||
19 | previewfile?: Blob | ||
20 | scheduleUpdate?: VideoScheduleUpdate | ||
21 | originallyPublishedAt?: Date | string | ||
22 | videoPasswords?: string[] | ||
23 | |||
24 | pluginData?: any | ||
25 | } | ||
diff --git a/packages/models/src/videos/video-view.model.ts b/packages/models/src/videos/video-view.model.ts new file mode 100644 index 000000000..f61211104 --- /dev/null +++ b/packages/models/src/videos/video-view.model.ts | |||
@@ -0,0 +1,6 @@ | |||
1 | export type VideoViewEvent = 'seek' | ||
2 | |||
3 | export interface VideoView { | ||
4 | currentTime: number | ||
5 | viewEvent?: VideoViewEvent | ||
6 | } | ||
diff --git a/packages/models/src/videos/video.model.ts b/packages/models/src/videos/video.model.ts new file mode 100644 index 000000000..a750e220d --- /dev/null +++ b/packages/models/src/videos/video.model.ts | |||
@@ -0,0 +1,99 @@ | |||
1 | import { Account, AccountSummary } from '../actors/index.js' | ||
2 | import { VideoChannel, VideoChannelSummary } from './channel/video-channel.model.js' | ||
3 | import { VideoFile } from './file/index.js' | ||
4 | import { VideoConstant } from './video-constant.model.js' | ||
5 | import { VideoPrivacyType } from './video-privacy.enum.js' | ||
6 | import { VideoScheduleUpdate } from './video-schedule-update.model.js' | ||
7 | import { VideoStateType } from './video-state.enum.js' | ||
8 | import { VideoStreamingPlaylist } from './video-streaming-playlist.model.js' | ||
9 | |||
10 | export interface Video extends Partial<VideoAdditionalAttributes> { | ||
11 | id: number | ||
12 | uuid: string | ||
13 | shortUUID: string | ||
14 | |||
15 | createdAt: Date | string | ||
16 | updatedAt: Date | string | ||
17 | publishedAt: Date | string | ||
18 | originallyPublishedAt: Date | string | ||
19 | category: VideoConstant<number> | ||
20 | licence: VideoConstant<number> | ||
21 | language: VideoConstant<string> | ||
22 | privacy: VideoConstant<VideoPrivacyType> | ||
23 | |||
24 | // Deprecated in 5.0 in favour of truncatedDescription | ||
25 | description: string | ||
26 | truncatedDescription: string | ||
27 | |||
28 | duration: number | ||
29 | isLocal: boolean | ||
30 | name: string | ||
31 | |||
32 | isLive: boolean | ||
33 | |||
34 | thumbnailPath: string | ||
35 | thumbnailUrl?: string | ||
36 | |||
37 | previewPath: string | ||
38 | previewUrl?: string | ||
39 | |||
40 | embedPath: string | ||
41 | embedUrl?: string | ||
42 | |||
43 | url: string | ||
44 | |||
45 | views: number | ||
46 | viewers: number | ||
47 | |||
48 | likes: number | ||
49 | dislikes: number | ||
50 | nsfw: boolean | ||
51 | |||
52 | account: AccountSummary | ||
53 | channel: VideoChannelSummary | ||
54 | |||
55 | userHistory?: { | ||
56 | currentTime: number | ||
57 | } | ||
58 | |||
59 | pluginData?: any | ||
60 | } | ||
61 | |||
62 | // Not included by default, needs query params | ||
63 | export interface VideoAdditionalAttributes { | ||
64 | waitTranscoding: boolean | ||
65 | state: VideoConstant<VideoStateType> | ||
66 | scheduledUpdate: VideoScheduleUpdate | ||
67 | |||
68 | blacklisted: boolean | ||
69 | blacklistedReason: string | ||
70 | |||
71 | blockedOwner: boolean | ||
72 | blockedServer: boolean | ||
73 | |||
74 | files: VideoFile[] | ||
75 | streamingPlaylists: VideoStreamingPlaylist[] | ||
76 | } | ||
77 | |||
78 | export interface VideoDetails extends Video { | ||
79 | // Deprecated in 5.0 | ||
80 | descriptionPath: string | ||
81 | |||
82 | support: string | ||
83 | channel: VideoChannel | ||
84 | account: Account | ||
85 | tags: string[] | ||
86 | commentsEnabled: boolean | ||
87 | downloadEnabled: boolean | ||
88 | |||
89 | // Not optional in details (unlike in parent Video) | ||
90 | waitTranscoding: boolean | ||
91 | state: VideoConstant<VideoStateType> | ||
92 | |||
93 | trackerUrls: string[] | ||
94 | |||
95 | files: VideoFile[] | ||
96 | streamingPlaylists: VideoStreamingPlaylist[] | ||
97 | |||
98 | inputFileUpdatedAt: string | Date | ||
99 | } | ||