aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/helpers/captions-utils.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-02-15 14:08:16 +0100
committerChocobozzz <chocobozzz@cpy.re>2021-02-16 10:36:44 +0100
commit6302d599cdf98b5a5363a2a1dcdc266447950191 (patch)
treeb7dc6dc0f08f0fb8a20720242c9c0a71afeeaa3f /server/helpers/captions-utils.ts
parenta8b1b40485145ac1eae513a661d7dd6e0986ce96 (diff)
downloadPeerTube-6302d599cdf98b5a5363a2a1dcdc266447950191.tar.gz
PeerTube-6302d599cdf98b5a5363a2a1dcdc266447950191.tar.zst
PeerTube-6302d599cdf98b5a5363a2a1dcdc266447950191.zip
Generate a name for caption files
Diffstat (limited to 'server/helpers/captions-utils.ts')
-rw-r--r--server/helpers/captions-utils.ts12
1 files changed, 6 insertions, 6 deletions
diff --git a/server/helpers/captions-utils.ts b/server/helpers/captions-utils.ts
index 7cbfb3561..401f2fb7b 100644
--- a/server/helpers/captions-utils.ts
+++ b/server/helpers/captions-utils.ts
@@ -1,12 +1,12 @@
1import { createReadStream, createWriteStream, move, remove } from 'fs-extra'
1import { join } from 'path' 2import { join } from 'path'
2import { CONFIG } from '../initializers/config'
3import * as srt2vtt from 'srt-to-vtt' 3import * as srt2vtt from 'srt-to-vtt'
4import { createReadStream, createWriteStream, move, remove } from 'fs-extra' 4import { MVideoCaption } from '@server/types/models'
5import { MVideoCaptionFormattable } from '@server/types/models' 5import { CONFIG } from '../initializers/config'
6 6
7async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: MVideoCaptionFormattable) { 7async function moveAndProcessCaptionFile (physicalFile: { filename: string, path: string }, videoCaption: MVideoCaption) {
8 const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR 8 const videoCaptionsDir = CONFIG.STORAGE.CAPTIONS_DIR
9 const destination = join(videoCaptionsDir, videoCaption.getCaptionName()) 9 const destination = join(videoCaptionsDir, videoCaption.filename)
10 10
11 // Convert this srt file to vtt 11 // Convert this srt file to vtt
12 if (physicalFile.path.endsWith('.srt')) { 12 if (physicalFile.path.endsWith('.srt')) {
@@ -17,7 +17,7 @@ async function moveAndProcessCaptionFile (physicalFile: { filename: string, path
17 } 17 }
18 18
19 // 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
20 physicalFile.filename = videoCaption.getCaptionName() 20 physicalFile.filename = videoCaption.filename
21 physicalFile.path = destination 21 physicalFile.path = destination
22} 22}
23 23