diff options
Diffstat (limited to 'shared/models/videos')
20 files changed, 154 insertions, 34 deletions
diff --git a/shared/models/videos/blacklist/video-blacklist.model.ts b/shared/models/videos/blacklist/video-blacklist.model.ts index 4bd976190..68d59e489 100644 --- a/shared/models/videos/blacklist/video-blacklist.model.ts +++ b/shared/models/videos/blacklist/video-blacklist.model.ts | |||
@@ -1,19 +1,17 @@ | |||
1 | import { Video } from '../video.model' | ||
2 | |||
3 | export enum VideoBlacklistType { | ||
4 | MANUAL = 1, | ||
5 | AUTO_BEFORE_PUBLISHED = 2 | ||
6 | } | ||
7 | |||
1 | export interface VideoBlacklist { | 8 | export interface VideoBlacklist { |
2 | id: number | 9 | id: number |
3 | createdAt: Date | 10 | createdAt: Date |
4 | updatedAt: Date | 11 | updatedAt: Date |
5 | unfederated: boolean | 12 | unfederated: boolean |
6 | reason?: string | 13 | reason?: string |
14 | type: VideoBlacklistType | ||
7 | 15 | ||
8 | video: { | 16 | video: Video |
9 | id: number | ||
10 | name: string | ||
11 | uuid: string | ||
12 | description: string | ||
13 | duration: number | ||
14 | views: number | ||
15 | likes: number | ||
16 | dislikes: number | ||
17 | nsfw: boolean | ||
18 | } | ||
19 | } | 17 | } |
diff --git a/shared/models/videos/channel/video-channel.model.ts b/shared/models/videos/channel/video-channel.model.ts index 92918f66c..14a813f8f 100644 --- a/shared/models/videos/channel/video-channel.model.ts +++ b/shared/models/videos/channel/video-channel.model.ts | |||
@@ -1,6 +1,6 @@ | |||
1 | import { Actor } from '../../actors/actor.model' | 1 | import { Actor } from '../../actors/actor.model' |
2 | import { Video } from '../video.model' | ||
3 | import { Account } from '../../actors/index' | 2 | import { Account } from '../../actors/index' |
3 | import { Avatar } from '../../avatars' | ||
4 | 4 | ||
5 | export interface VideoChannel extends Actor { | 5 | export interface VideoChannel extends Actor { |
6 | displayName: string | 6 | displayName: string |
@@ -9,3 +9,13 @@ export interface VideoChannel extends Actor { | |||
9 | isLocal: boolean | 9 | isLocal: boolean |
10 | ownerAccount?: Account | 10 | ownerAccount?: Account |
11 | } | 11 | } |
12 | |||
13 | export interface VideoChannelSummary { | ||
14 | id: number | ||
15 | uuid: string | ||
16 | name: string | ||
17 | displayName: string | ||
18 | url: string | ||
19 | host: string | ||
20 | avatar?: Avatar | ||
21 | } | ||
diff --git a/shared/models/videos/import/video-import.model.ts b/shared/models/videos/import/video-import.model.ts index e2a56617d..92856c70f 100644 --- a/shared/models/videos/import/video-import.model.ts +++ b/shared/models/videos/import/video-import.model.ts | |||
@@ -11,6 +11,7 @@ export interface VideoImport { | |||
11 | 11 | ||
12 | createdAt: string | 12 | createdAt: string |
13 | updatedAt: string | 13 | updatedAt: string |
14 | originallyPublishedAt?: string | ||
14 | state: VideoConstant<VideoImportState> | 15 | state: VideoConstant<VideoImportState> |
15 | error?: string | 16 | error?: string |
16 | 17 | ||
diff --git a/shared/models/videos/index.ts b/shared/models/videos/index.ts index 056ae06da..e3d78220e 100644 --- a/shared/models/videos/index.ts +++ b/shared/models/videos/index.ts | |||
@@ -1,5 +1,6 @@ | |||
1 | export * from './rate/user-video-rate-update.model' | 1 | export * from './rate/user-video-rate-update.model' |
2 | export * from './rate/user-video-rate.model' | 2 | export * from './rate/user-video-rate.model' |
3 | export * from './rate/account-video-rate.model' | ||
3 | export * from './rate/user-video-rate.type' | 4 | export * from './rate/user-video-rate.type' |
4 | export * from './abuse/video-abuse-state.model' | 5 | export * from './abuse/video-abuse-state.model' |
5 | export * from './abuse/video-abuse-create.model' | 6 | export * from './abuse/video-abuse-create.model' |
@@ -11,6 +12,13 @@ export * from './blacklist/video-blacklist-update.model' | |||
11 | export * from './channel/video-channel-create.model' | 12 | export * from './channel/video-channel-create.model' |
12 | export * from './channel/video-channel-update.model' | 13 | export * from './channel/video-channel-update.model' |
13 | export * from './channel/video-channel.model' | 14 | export * from './channel/video-channel.model' |
15 | export * from './playlist/video-playlist-create.model' | ||
16 | export * from './playlist/video-playlist-element-create.model' | ||
17 | export * from './playlist/video-playlist-element-update.model' | ||
18 | export * from './playlist/video-playlist-privacy.model' | ||
19 | export * from './playlist/video-playlist-type.model' | ||
20 | export * from './playlist/video-playlist-update.model' | ||
21 | export * from './playlist/video-playlist.model' | ||
14 | export * from './video-change-ownership.model' | 22 | export * from './video-change-ownership.model' |
15 | export * from './video-change-ownership-create.model' | 23 | export * from './video-change-ownership-create.model' |
16 | export * from './video-create.model' | 24 | export * from './video-create.model' |
@@ -27,4 +35,4 @@ export * from './caption/video-caption-update.model' | |||
27 | export * from './import/video-import-create.model' | 35 | export * from './import/video-import-create.model' |
28 | export * from './import/video-import-state.enum' | 36 | export * from './import/video-import-state.enum' |
29 | export * from './import/video-import.model' | 37 | export * from './import/video-import.model' |
30 | export { VideoConstant } from './video-constant.model' | 38 | export * from './video-constant.model' |
diff --git a/shared/models/videos/playlist/video-exist-in-playlist.model.ts b/shared/models/videos/playlist/video-exist-in-playlist.model.ts new file mode 100644 index 000000000..71240f51d --- /dev/null +++ b/shared/models/videos/playlist/video-exist-in-playlist.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | export type VideoExistInPlaylist = { | ||
2 | [videoId: number ]: { | ||
3 | playlistId: number | ||
4 | startTimestamp?: number | ||
5 | stopTimestamp?: number | ||
6 | }[] | ||
7 | } | ||
diff --git a/shared/models/videos/playlist/video-playlist-create.model.ts b/shared/models/videos/playlist/video-playlist-create.model.ts new file mode 100644 index 000000000..67a33fa35 --- /dev/null +++ b/shared/models/videos/playlist/video-playlist-create.model.ts | |||
@@ -0,0 +1,11 @@ | |||
1 | import { VideoPlaylistPrivacy } from './video-playlist-privacy.model' | ||
2 | |||
3 | export interface VideoPlaylistCreate { | ||
4 | displayName: string | ||
5 | privacy: VideoPlaylistPrivacy | ||
6 | |||
7 | description?: string | ||
8 | videoChannelId?: number | ||
9 | |||
10 | thumbnailfile?: any | ||
11 | } | ||
diff --git a/shared/models/videos/playlist/video-playlist-element-create.model.ts b/shared/models/videos/playlist/video-playlist-element-create.model.ts new file mode 100644 index 000000000..c31702892 --- /dev/null +++ b/shared/models/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/shared/models/videos/playlist/video-playlist-element-update.model.ts b/shared/models/videos/playlist/video-playlist-element-update.model.ts new file mode 100644 index 000000000..15a30fbdc --- /dev/null +++ b/shared/models/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/shared/models/videos/playlist/video-playlist-privacy.model.ts b/shared/models/videos/playlist/video-playlist-privacy.model.ts new file mode 100644 index 000000000..96e5e2211 --- /dev/null +++ b/shared/models/videos/playlist/video-playlist-privacy.model.ts | |||
@@ -0,0 +1,5 @@ | |||
1 | export enum VideoPlaylistPrivacy { | ||
2 | PUBLIC = 1, | ||
3 | UNLISTED = 2, | ||
4 | PRIVATE = 3 | ||
5 | } | ||
diff --git a/shared/models/videos/playlist/video-playlist-reorder.model.ts b/shared/models/videos/playlist/video-playlist-reorder.model.ts new file mode 100644 index 000000000..63ec714c5 --- /dev/null +++ b/shared/models/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/shared/models/videos/playlist/video-playlist-type.model.ts b/shared/models/videos/playlist/video-playlist-type.model.ts new file mode 100644 index 000000000..49233b743 --- /dev/null +++ b/shared/models/videos/playlist/video-playlist-type.model.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export enum VideoPlaylistType { | ||
2 | REGULAR = 1, | ||
3 | WATCH_LATER = 2 | ||
4 | } | ||
diff --git a/shared/models/videos/playlist/video-playlist-update.model.ts b/shared/models/videos/playlist/video-playlist-update.model.ts new file mode 100644 index 000000000..0ff5bcb0f --- /dev/null +++ b/shared/models/videos/playlist/video-playlist-update.model.ts | |||
@@ -0,0 +1,10 @@ | |||
1 | import { VideoPlaylistPrivacy } from './video-playlist-privacy.model' | ||
2 | |||
3 | export interface VideoPlaylistUpdate { | ||
4 | displayName: string | ||
5 | privacy: VideoPlaylistPrivacy | ||
6 | |||
7 | description?: string | ||
8 | videoChannelId?: number | ||
9 | thumbnailfile?: any | ||
10 | } | ||
diff --git a/shared/models/videos/playlist/video-playlist.model.ts b/shared/models/videos/playlist/video-playlist.model.ts new file mode 100644 index 000000000..c0941727a --- /dev/null +++ b/shared/models/videos/playlist/video-playlist.model.ts | |||
@@ -0,0 +1,26 @@ | |||
1 | import { AccountSummary } from '../../actors/index' | ||
2 | import { VideoChannelSummary, VideoConstant } from '..' | ||
3 | import { VideoPlaylistPrivacy } from './video-playlist-privacy.model' | ||
4 | import { VideoPlaylistType } from './video-playlist-type.model' | ||
5 | |||
6 | export interface VideoPlaylist { | ||
7 | id: number | ||
8 | uuid: string | ||
9 | isLocal: boolean | ||
10 | |||
11 | displayName: string | ||
12 | description: string | ||
13 | privacy: VideoConstant<VideoPlaylistPrivacy> | ||
14 | |||
15 | thumbnailPath: string | ||
16 | |||
17 | videosLength: number | ||
18 | |||
19 | type: VideoConstant<VideoPlaylistType> | ||
20 | |||
21 | createdAt: Date | string | ||
22 | updatedAt: Date | string | ||
23 | |||
24 | ownerAccount: AccountSummary | ||
25 | videoChannel?: VideoChannelSummary | ||
26 | } | ||
diff --git a/shared/models/videos/rate/account-video-rate.model.ts b/shared/models/videos/rate/account-video-rate.model.ts new file mode 100644 index 000000000..e789367dc --- /dev/null +++ b/shared/models/videos/rate/account-video-rate.model.ts | |||
@@ -0,0 +1,7 @@ | |||
1 | import { UserVideoRateType } from './user-video-rate.type' | ||
2 | import { Video } from '../video.model' | ||
3 | |||
4 | export interface AccountVideoRate { | ||
5 | video: Video | ||
6 | rating: UserVideoRateType | ||
7 | } | ||
diff --git a/shared/models/videos/thumbnail.type.ts b/shared/models/videos/thumbnail.type.ts new file mode 100644 index 000000000..d6c2bef7b --- /dev/null +++ b/shared/models/videos/thumbnail.type.ts | |||
@@ -0,0 +1,4 @@ | |||
1 | export enum ThumbnailType { | ||
2 | MINIATURE = 1, | ||
3 | PREVIEW = 2 | ||
4 | } | ||
diff --git a/shared/models/videos/video-create.model.ts b/shared/models/videos/video-create.model.ts index 190d63783..53631bf79 100644 --- a/shared/models/videos/video-create.model.ts +++ b/shared/models/videos/video-create.model.ts | |||
@@ -13,6 +13,8 @@ export interface VideoCreate { | |||
13 | name: string | 13 | name: string |
14 | tags?: string[] | 14 | tags?: string[] |
15 | commentsEnabled?: boolean | 15 | commentsEnabled?: boolean |
16 | downloadEnabled?: boolean | ||
16 | privacy: VideoPrivacy | 17 | privacy: VideoPrivacy |
17 | scheduleUpdate?: VideoScheduleUpdate | 18 | scheduleUpdate?: VideoScheduleUpdate |
19 | originallyPublishedAt: Date | string | ||
18 | } | 20 | } |
diff --git a/shared/models/videos/video-streaming-playlist.model.ts b/shared/models/videos/video-streaming-playlist.model.ts new file mode 100644 index 000000000..17f8fe865 --- /dev/null +++ b/shared/models/videos/video-streaming-playlist.model.ts | |||
@@ -0,0 +1,12 @@ | |||
1 | import { VideoStreamingPlaylistType } from './video-streaming-playlist.type' | ||
2 | |||
3 | export class VideoStreamingPlaylist { | ||
4 | id: number | ||
5 | type: VideoStreamingPlaylistType | ||
6 | playlistUrl: string | ||
7 | segmentsSha256Url: string | ||
8 | |||
9 | redundancies: { | ||
10 | baseUrl: string | ||
11 | }[] | ||
12 | } | ||
diff --git a/shared/models/videos/video-streaming-playlist.type.ts b/shared/models/videos/video-streaming-playlist.type.ts new file mode 100644 index 000000000..3b403f295 --- /dev/null +++ b/shared/models/videos/video-streaming-playlist.type.ts | |||
@@ -0,0 +1,3 @@ | |||
1 | export enum VideoStreamingPlaylistType { | ||
2 | HLS = 1 | ||
3 | } | ||
diff --git a/shared/models/videos/video-update.model.ts b/shared/models/videos/video-update.model.ts index ed141a824..4ef904156 100644 --- a/shared/models/videos/video-update.model.ts +++ b/shared/models/videos/video-update.model.ts | |||
@@ -11,10 +11,12 @@ export interface VideoUpdate { | |||
11 | privacy?: VideoPrivacy | 11 | privacy?: VideoPrivacy |
12 | tags?: string[] | 12 | tags?: string[] |
13 | commentsEnabled?: boolean | 13 | commentsEnabled?: boolean |
14 | downloadEnabled?: boolean | ||
14 | nsfw?: boolean | 15 | nsfw?: boolean |
15 | waitTranscoding?: boolean | 16 | waitTranscoding?: boolean |
16 | channelId?: number | 17 | channelId?: number |
17 | thumbnailfile?: Blob | 18 | thumbnailfile?: Blob |
18 | previewfile?: Blob | 19 | previewfile?: Blob |
19 | scheduleUpdate?: VideoScheduleUpdate | 20 | scheduleUpdate?: VideoScheduleUpdate |
21 | originallyPublishedAt?: Date | string | ||
20 | } | 22 | } |
diff --git a/shared/models/videos/video.model.ts b/shared/models/videos/video.model.ts index 022876a0b..963268674 100644 --- a/shared/models/videos/video.model.ts +++ b/shared/models/videos/video.model.ts | |||
@@ -1,10 +1,11 @@ | |||
1 | import { VideoResolution, VideoState } from '../../index' | 1 | import { AccountSummary, VideoChannelSummary, VideoResolution, VideoState } from '../../index' |
2 | import { Account } from '../actors' | 2 | import { Account } from '../actors' |
3 | import { Avatar } from '../avatars/avatar.model' | 3 | import { Avatar } from '../avatars/avatar.model' |
4 | import { VideoChannel } from './channel/video-channel.model' | 4 | import { VideoChannel } from './channel/video-channel.model' |
5 | import { VideoPrivacy } from './video-privacy.enum' | 5 | import { VideoPrivacy } from './video-privacy.enum' |
6 | import { VideoScheduleUpdate } from './video-schedule-update.model' | 6 | import { VideoScheduleUpdate } from './video-schedule-update.model' |
7 | import { VideoConstant } from './video-constant.model' | 7 | import { VideoConstant } from './video-constant.model' |
8 | import { VideoStreamingPlaylist } from './video-streaming-playlist.model' | ||
8 | 9 | ||
9 | export interface VideoFile { | 10 | export interface VideoFile { |
10 | magnetUri: string | 11 | magnetUri: string |
@@ -17,24 +18,10 @@ export interface VideoFile { | |||
17 | fps: number | 18 | fps: number |
18 | } | 19 | } |
19 | 20 | ||
20 | export interface VideoChannelAttribute { | 21 | export interface PlaylistElement { |
21 | id: number | 22 | position: number |
22 | uuid: string | 23 | startTimestamp: number |
23 | name: string | 24 | stopTimestamp: number |
24 | displayName: string | ||
25 | url: string | ||
26 | host: string | ||
27 | avatar?: Avatar | ||
28 | } | ||
29 | |||
30 | export interface AccountAttribute { | ||
31 | id: number | ||
32 | uuid: string | ||
33 | name: string | ||
34 | displayName: string | ||
35 | url: string | ||
36 | host: string | ||
37 | avatar?: Avatar | ||
38 | } | 25 | } |
39 | 26 | ||
40 | export interface Video { | 27 | export interface Video { |
@@ -43,6 +30,7 @@ export interface Video { | |||
43 | createdAt: Date | string | 30 | createdAt: Date | string |
44 | updatedAt: Date | string | 31 | updatedAt: Date | string |
45 | publishedAt: Date | string | 32 | publishedAt: Date | string |
33 | originallyPublishedAt: Date | string | ||
46 | category: VideoConstant<number> | 34 | category: VideoConstant<number> |
47 | licence: VideoConstant<number> | 35 | licence: VideoConstant<number> |
48 | language: VideoConstant<string> | 36 | language: VideoConstant<string> |
@@ -66,12 +54,14 @@ export interface Video { | |||
66 | blacklisted?: boolean | 54 | blacklisted?: boolean |
67 | blacklistedReason?: string | 55 | blacklistedReason?: string |
68 | 56 | ||
69 | account: AccountAttribute | 57 | account: AccountSummary |
70 | channel: VideoChannelAttribute | 58 | channel: VideoChannelSummary |
71 | 59 | ||
72 | userHistory?: { | 60 | userHistory?: { |
73 | currentTime: number | 61 | currentTime: number |
74 | } | 62 | } |
63 | |||
64 | playlistElement?: PlaylistElement | ||
75 | } | 65 | } |
76 | 66 | ||
77 | export interface VideoDetails extends Video { | 67 | export interface VideoDetails extends Video { |
@@ -82,8 +72,13 @@ export interface VideoDetails extends Video { | |||
82 | files: VideoFile[] | 72 | files: VideoFile[] |
83 | account: Account | 73 | account: Account |
84 | commentsEnabled: boolean | 74 | commentsEnabled: boolean |
75 | downloadEnabled: boolean | ||
85 | 76 | ||
86 | // Not optional in details (unlike in Video) | 77 | // Not optional in details (unlike in Video) |
87 | waitTranscoding: boolean | 78 | waitTranscoding: boolean |
88 | state: VideoConstant<VideoState> | 79 | state: VideoConstant<VideoState> |
80 | |||
81 | trackerUrls: string[] | ||
82 | |||
83 | streamingPlaylists: VideoStreamingPlaylist[] | ||
89 | } | 84 | } |