aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/captions-utils.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/helpers/captions-utils.ts')
-rw-r--r--server/helpers/captions-utils.ts7
1 files changed, 3 insertions, 4 deletions
diff --git a/server/helpers/captions-utils.ts b/server/helpers/captions-utils.ts
index 20c9fe5aa..660dce65c 100644
--- a/server/helpers/captions-utils.ts
+++ b/server/helpers/captions-utils.ts
@@ -1,9 +1,8 @@
1import { renamePromise, unlinkPromise } from './core-utils'
2import { join } from 'path' 1import { join } from 'path'
3import { CONFIG } from '../initializers' 2import { CONFIG } from '../initializers'
4import { VideoCaptionModel } from '../models/video/video-caption' 3import { VideoCaptionModel } from '../models/video/video-caption'
5import * as srt2vtt from 'srt-to-vtt' 4import * as srt2vtt from 'srt-to-vtt'
6import { createReadStream, createWriteStream } from 'fs-extra' 5import { createReadStream, createWriteStream, remove, rename } from 'fs-extra'
7 6
8async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: VideoCaptionModel) { 7async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: VideoCaptionModel) {
9 const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR 8 const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR
@@ -12,9 +11,9 @@ async function moveAndProcessCaptionFile (physicalFile: { filename: string, path
12 // Convert this srt file to vtt 11 // Convert this srt file to vtt
13 if (physicalFile.path.endsWith('.srt')) { 12 if (physicalFile.path.endsWith('.srt')) {
14 await convertSrtToVtt(physicalFile.path, destination) 13 await convertSrtToVtt(physicalFile.path, destination)
15 await unlinkPromise(physicalFile.path) 14 await remove(physicalFile.path)
16 } else { // Just move the vtt file 15 } else { // Just move the vtt file
17 await renamePromise(physicalFile.path, destination) 16 await rename(physicalFile.path, destination)
18 } 17 }
19 18
20 // This is important in case if there is another attempt in the retry process 19 // This is important in case if there is another attempt in the retry process