diff options
author | Chocobozzz <me@florianbigard.com> | 2022-03-22 16:58:49 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2022-03-22 17:24:32 +0100 |
commit | 92e66e04f7f51d37b465cff442ce47f6d6d7cadd (patch) | |
tree | 4475c5c601c0f6673ca56afba5b7f70a4fae4ec3 /server/lib/video-editor.ts | |
parent | 1808a1f8e4b7b102823492a2007a46929aebf189 (diff) | |
download | PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.tar.gz PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.tar.zst PeerTube-92e66e04f7f51d37b465cff442ce47f6d6d7cadd.zip |
Rename studio to editor
Diffstat (limited to 'server/lib/video-editor.ts')
-rw-r--r-- | server/lib/video-editor.ts | 32 |
1 files changed, 0 insertions, 32 deletions
diff --git a/server/lib/video-editor.ts b/server/lib/video-editor.ts deleted file mode 100644 index 99b0bd949..000000000 --- a/server/lib/video-editor.ts +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | import { MVideoFullLight } from "@server/types/models" | ||
2 | import { getVideoStreamDuration } from "@shared/extra-utils" | ||
3 | import { VideoEditorTask } from "@shared/models" | ||
4 | |||
5 | function buildTaskFileFieldname (indice: number, fieldName = 'file') { | ||
6 | return `tasks[${indice}][options][${fieldName}]` | ||
7 | } | ||
8 | |||
9 | function getTaskFile (files: Express.Multer.File[], indice: number, fieldName = 'file') { | ||
10 | return files.find(f => f.fieldname === buildTaskFileFieldname(indice, fieldName)) | ||
11 | } | ||
12 | |||
13 | async function approximateIntroOutroAdditionalSize (video: MVideoFullLight, tasks: VideoEditorTask[], fileFinder: (i: number) => string) { | ||
14 | let additionalDuration = 0 | ||
15 | |||
16 | for (let i = 0; i < tasks.length; i++) { | ||
17 | const task = tasks[i] | ||
18 | |||
19 | if (task.name !== 'add-intro' && task.name !== 'add-outro') continue | ||
20 | |||
21 | const filePath = fileFinder(i) | ||
22 | additionalDuration += await getVideoStreamDuration(filePath) | ||
23 | } | ||
24 | |||
25 | return (video.getMaxQualityFile().size / video.duration) * additionalDuration | ||
26 | } | ||
27 | |||
28 | export { | ||
29 | approximateIntroOutroAdditionalSize, | ||
30 | buildTaskFileFieldname, | ||
31 | getTaskFile | ||
32 | } | ||