]>
Commit | Line | Data |
---|---|---|
c6c0fa6c C |
1 | |
2 | import { VideoModel } from '@server/models/video/video' | |
3 | import { FilteredModelAttributes } from '@server/types' | |
4 | import { VideoCreate, VideoPrivacy, VideoState } from '@shared/models' | |
5 | ||
6 | function 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 | ||
29 | export { | |
30 | buildLocalVideoFromCreate | |
31 | } |