aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/import.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/import.ts')
-rw-r--r--server/controllers/api/videos/import.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/server/controllers/api/videos/import.ts b/server/controllers/api/videos/import.ts
index 4ed58f978..2c225315c 100644
--- a/server/controllers/api/videos/import.ts
+++ b/server/controllers/api/videos/import.ts
@@ -5,6 +5,7 @@ import * as parseTorrent from 'parse-torrent'
5import { join } from 'path' 5import { join } from 'path'
6import { getEnabledResolutions } from '@server/lib/config' 6import { getEnabledResolutions } from '@server/lib/config'
7import { setVideoTags } from '@server/lib/video' 7import { setVideoTags } from '@server/lib/video'
8import { FilteredModelAttributes } from '@server/types'
8import { 9import {
9 MChannelAccountDefault, 10 MChannelAccountDefault,
10 MThumbnail, 11 MThumbnail,
@@ -15,7 +16,7 @@ import {
15 MVideoThumbnail, 16 MVideoThumbnail,
16 MVideoWithBlacklistLight 17 MVideoWithBlacklistLight
17} from '@server/types/models' 18} from '@server/types/models'
18import { MVideoImport, MVideoImportFormattable } from '@server/types/models/video/video-import' 19import { MVideoImportFormattable } from '@server/types/models/video/video-import'
19import { ServerErrorCode, VideoImportCreate, VideoImportState, VideoPrivacy, VideoState } from '../../../../shared' 20import { ServerErrorCode, VideoImportCreate, VideoImportState, VideoPrivacy, VideoState } from '../../../../shared'
20import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes' 21import { HttpStatusCode } from '../../../../shared/core-utils/miscs/http-error-codes'
21import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type' 22import { ThumbnailType } from '../../../../shared/models/videos/thumbnail.type'
@@ -253,7 +254,9 @@ function buildVideo (channelId: number, body: VideoImportCreate, importData: You
253 privacy: body.privacy || VideoPrivacy.PRIVATE, 254 privacy: body.privacy || VideoPrivacy.PRIVATE,
254 duration: 0, // duration will be set by the import job 255 duration: 0, // duration will be set by the import job
255 channelId: channelId, 256 channelId: channelId,
256 originallyPublishedAt: body.originallyPublishedAt || importData.originallyPublishedAt 257 originallyPublishedAt: body.originallyPublishedAt
258 ? new Date(body.originallyPublishedAt)
259 : importData.originallyPublishedAt
257 } 260 }
258 const video = new VideoModel(videoData) 261 const video = new VideoModel(videoData)
259 video.url = getLocalVideoActivityPubUrl(video) 262 video.url = getLocalVideoActivityPubUrl(video)
@@ -317,7 +320,7 @@ async function insertIntoDB (parameters: {
317 previewModel: MThumbnail 320 previewModel: MThumbnail
318 videoChannel: MChannelAccountDefault 321 videoChannel: MChannelAccountDefault
319 tags: string[] 322 tags: string[]
320 videoImportAttributes: Partial<MVideoImport> 323 videoImportAttributes: FilteredModelAttributes<VideoImportModel>
321 user: MUser 324 user: MUser
322}): Promise<MVideoImportFormattable> { 325}): Promise<MVideoImportFormattable> {
323 const { video, thumbnailModel, previewModel, videoChannel, tags, videoImportAttributes, user } = parameters 326 const { video, thumbnailModel, previewModel, videoChannel, tags, videoImportAttributes, user } = parameters