aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/controllers/api/videos/index.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/controllers/api/videos/index.ts')
-rw-r--r--server/controllers/api/videos/index.ts12
1 files changed, 5 insertions, 7 deletions
diff --git a/server/controllers/api/videos/index.ts b/server/controllers/api/videos/index.ts
index 4e4697ef4..00a1302d1 100644
--- a/server/controllers/api/videos/index.ts
+++ b/server/controllers/api/videos/index.ts
@@ -7,15 +7,13 @@ import { logger } from '../../../helpers/logger'
7import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger' 7import { auditLoggerFactory, getAuditIdFromRes, VideoAuditView } from '../../../helpers/audit-logger'
8import { getFormattedObjects, getServerActor } from '../../../helpers/utils' 8import { getFormattedObjects, getServerActor } from '../../../helpers/utils'
9import { 9import {
10 CONFIG, 10 CONFIG, MIMETYPES,
11 IMAGE_MIMETYPE_EXT,
12 PREVIEWS_SIZE, 11 PREVIEWS_SIZE,
13 sequelizeTypescript, 12 sequelizeTypescript,
14 THUMBNAILS_SIZE, 13 THUMBNAILS_SIZE,
15 VIDEO_CATEGORIES, 14 VIDEO_CATEGORIES,
16 VIDEO_LANGUAGES, 15 VIDEO_LANGUAGES,
17 VIDEO_LICENCES, 16 VIDEO_LICENCES,
18 VIDEO_MIMETYPE_EXT,
19 VIDEO_PRIVACIES 17 VIDEO_PRIVACIES
20} from '../../../initializers' 18} from '../../../initializers'
21import { 19import {
@@ -57,7 +55,7 @@ import { ScheduleVideoUpdateModel } from '../../../models/video/schedule-video-u
57import { videoCaptionsRouter } from './captions' 55import { videoCaptionsRouter } from './captions'
58import { videoImportsRouter } from './import' 56import { videoImportsRouter } from './import'
59import { resetSequelizeInstance } from '../../../helpers/database-utils' 57import { resetSequelizeInstance } from '../../../helpers/database-utils'
60import { rename } from 'fs-extra' 58import { move } from 'fs-extra'
61import { watchingRouter } from './watching' 59import { watchingRouter } from './watching'
62 60
63const auditLogger = auditLoggerFactory('videos') 61const auditLogger = auditLoggerFactory('videos')
@@ -65,7 +63,7 @@ const videosRouter = express.Router()
65 63
66const reqVideoFileAdd = createReqFiles( 64const reqVideoFileAdd = createReqFiles(
67 [ 'videofile', 'thumbnailfile', 'previewfile' ], 65 [ 'videofile', 'thumbnailfile', 'previewfile' ],
68 Object.assign({}, VIDEO_MIMETYPE_EXT, IMAGE_MIMETYPE_EXT), 66 Object.assign({}, MIMETYPES.VIDEO.MIMETYPE_EXT, MIMETYPES.IMAGE.MIMETYPE_EXT),
69 { 67 {
70 videofile: CONFIG.STORAGE.TMP_DIR, 68 videofile: CONFIG.STORAGE.TMP_DIR,
71 thumbnailfile: CONFIG.STORAGE.TMP_DIR, 69 thumbnailfile: CONFIG.STORAGE.TMP_DIR,
@@ -74,7 +72,7 @@ const reqVideoFileAdd = createReqFiles(
74) 72)
75const reqVideoFileUpdate = createReqFiles( 73const reqVideoFileUpdate = createReqFiles(
76 [ 'thumbnailfile', 'previewfile' ], 74 [ 'thumbnailfile', 'previewfile' ],
77 IMAGE_MIMETYPE_EXT, 75 MIMETYPES.IMAGE.MIMETYPE_EXT,
78 { 76 {
79 thumbnailfile: CONFIG.STORAGE.TMP_DIR, 77 thumbnailfile: CONFIG.STORAGE.TMP_DIR,
80 previewfile: CONFIG.STORAGE.TMP_DIR 78 previewfile: CONFIG.STORAGE.TMP_DIR
@@ -208,7 +206,7 @@ async function addVideo (req: express.Request, res: express.Response) {
208 // Move physical file 206 // Move physical file
209 const videoDir = CONFIG.STORAGE.VIDEOS_DIR 207 const videoDir = CONFIG.STORAGE.VIDEOS_DIR
210 const destination = join(videoDir, video.getVideoFilename(videoFile)) 208 const destination = join(videoDir, video.getVideoFilename(videoFile))
211 await rename(videoPhysicalFile.path, destination) 209 await move(videoPhysicalFile.path, destination)
212 // This is important in case if there is another attempt in the retry process 210 // This is important in case if there is another attempt in the retry process
213 videoPhysicalFile.filename = video.getVideoFilename(videoFile) 211 videoPhysicalFile.filename = video.getVideoFilename(videoFile)
214 videoPhysicalFile.path = destination 212 videoPhysicalFile.path = destination