diff options
Diffstat (limited to 'server/helpers/captions-utils.ts')
-rw-r--r-- | server/helpers/captions-utils.ts | 7 |
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 @@ | |||
1 | import { renamePromise, unlinkPromise } from './core-utils' | ||
2 | import { join } from 'path' | 1 | import { join } from 'path' |
3 | import { CONFIG } from '../initializers' | 2 | import { CONFIG } from '../initializers' |
4 | import { VideoCaptionModel } from '../models/video/video-caption' | 3 | import { VideoCaptionModel } from '../models/video/video-caption' |
5 | import * as srt2vtt from 'srt-to-vtt' | 4 | import * as srt2vtt from 'srt-to-vtt' |
6 | import { createReadStream, createWriteStream } from 'fs-extra' | 5 | import { createReadStream, createWriteStream, remove, rename } from 'fs-extra' |
7 | 6 | ||
8 | async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: VideoCaptionModel) { | 7 | async 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 |