aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/lib/video.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/lib/video.ts')
-rw-r--r--server/lib/video.ts31
1 files changed, 31 insertions, 0 deletions
diff --git a/server/lib/video.ts b/server/lib/video.ts
new file mode 100644
index 000000000..a28f31529
--- /dev/null
+++ b/server/lib/video.ts
@@ -0,0 +1,31 @@
1
2import { VideoModel } from '@server/models/video/video'
3import { FilteredModelAttributes } from '@server/types'
4import { VideoCreate, VideoPrivacy, VideoState } from '@shared/models'
5
6function buildLocalVideoFromCreate (videoInfo: VideoCreate, channelId: number): FilteredModelAttributes<VideoModel> {
7 return {
8 name: videoInfo.name,
9 remote: false,
10 category: videoInfo.category,
11 licence: videoInfo.licence,
12 language: videoInfo.language,
13 commentsEnabled: videoInfo.commentsEnabled !== false, // If the value is not "false", the default is "true"
14 downloadEnabled: videoInfo.downloadEnabled !== false,
15 waitTranscoding: videoInfo.waitTranscoding || false,
16 state: VideoState.WAITING_FOR_LIVE,
17 nsfw: videoInfo.nsfw || false,
18 description: videoInfo.description,
19 support: videoInfo.support,
20 privacy: videoInfo.privacy || VideoPrivacy.PRIVATE,
21 duration: 0,
22 channelId: channelId,
23 originallyPublishedAt: videoInfo.originallyPublishedAt
24 }
25}
26
27// ---------------------------------------------------------------------------
28
29export {
30 buildLocalVideoFromCreate
31}