diff options
author | Chocobozzz <me@florianbigard.com> | 2020-11-20 15:06:56 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2020-11-20 15:11:31 +0100 |
commit | d218e7de9400938ae6ac593d9ae5842e23abd4f0 (patch) | |
tree | f73795a2e9bea35d53923c8ac6a12098357152b9 /shared | |
parent | da2516fde1ad8f049c99ba5fd98c37425f379199 (diff) | |
download | PeerTube-d218e7de9400938ae6ac593d9ae5842e23abd4f0.tar.gz PeerTube-d218e7de9400938ae6ac593d9ae5842e23abd4f0.tar.zst PeerTube-d218e7de9400938ae6ac593d9ae5842e23abd4f0.zip |
Do not transcode to an higher bitrate
Thanks bkil https://github.com/bkil
Diffstat (limited to 'shared')
-rw-r--r-- | shared/extra-utils/miscs/miscs.ts | 9 | ||||
-rw-r--r-- | shared/extra-utils/server/servers.ts | 9 |
2 files changed, 16 insertions, 2 deletions
diff --git a/shared/extra-utils/miscs/miscs.ts b/shared/extra-utils/miscs/miscs.ts index dfd6e28cb..3c8191ae8 100644 --- a/shared/extra-utils/miscs/miscs.ts +++ b/shared/extra-utils/miscs/miscs.ts | |||
@@ -4,7 +4,7 @@ import * as chai from 'chai' | |||
4 | import { basename, dirname, isAbsolute, join, resolve } from 'path' | 4 | import { basename, dirname, isAbsolute, join, resolve } from 'path' |
5 | import * as request from 'supertest' | 5 | import * as request from 'supertest' |
6 | import * as WebTorrent from 'webtorrent' | 6 | import * as WebTorrent from 'webtorrent' |
7 | import { ensureDir, pathExists, readFile } from 'fs-extra' | 7 | import { ensureDir, pathExists, readFile, stat } from 'fs-extra' |
8 | import * as ffmpeg from 'fluent-ffmpeg' | 8 | import * as ffmpeg from 'fluent-ffmpeg' |
9 | 9 | ||
10 | const expect = chai.expect | 10 | const expect = chai.expect |
@@ -130,6 +130,12 @@ async function generateVideoWithFramerate (fps = 60) { | |||
130 | return tempFixturePath | 130 | return tempFixturePath |
131 | } | 131 | } |
132 | 132 | ||
133 | async function getFileSize (path: string) { | ||
134 | const stats = await stat(path) | ||
135 | |||
136 | return stats.size | ||
137 | } | ||
138 | |||
133 | // --------------------------------------------------------------------------- | 139 | // --------------------------------------------------------------------------- |
134 | 140 | ||
135 | export { | 141 | export { |
@@ -138,6 +144,7 @@ export { | |||
138 | areHttpImportTestsDisabled, | 144 | areHttpImportTestsDisabled, |
139 | buildServerDirectory, | 145 | buildServerDirectory, |
140 | webtorrentAdd, | 146 | webtorrentAdd, |
147 | getFileSize, | ||
141 | immutableAssign, | 148 | immutableAssign, |
142 | testImage, | 149 | testImage, |
143 | buildAbsoluteFixturePath, | 150 | buildAbsoluteFixturePath, |
diff --git a/shared/extra-utils/server/servers.ts b/shared/extra-utils/server/servers.ts index 6140cebb5..a647b0eb4 100644 --- a/shared/extra-utils/server/servers.ts +++ b/shared/extra-utils/server/servers.ts | |||
@@ -6,7 +6,7 @@ import { copy, pathExists, readdir, readFile, remove } from 'fs-extra' | |||
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { randomInt } from '../../core-utils/miscs/miscs' | 7 | import { randomInt } from '../../core-utils/miscs/miscs' |
8 | import { VideoChannel } from '../../models/videos' | 8 | import { VideoChannel } from '../../models/videos' |
9 | import { root, wait } from '../miscs/miscs' | 9 | import { getFileSize, root, wait } from '../miscs/miscs' |
10 | 10 | ||
11 | interface ServerInfo { | 11 | interface ServerInfo { |
12 | app: ChildProcess | 12 | app: ChildProcess |
@@ -318,11 +318,18 @@ async function waitUntilLog (server: ServerInfo, str: string, count = 1, strictC | |||
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||
321 | async function getServerFileSize (server: ServerInfo, subPath: string) { | ||
322 | const path = join(root(), 'test' + server.internalServerNumber, subPath) | ||
323 | |||
324 | return getFileSize(path) | ||
325 | } | ||
326 | |||
321 | // --------------------------------------------------------------------------- | 327 | // --------------------------------------------------------------------------- |
322 | 328 | ||
323 | export { | 329 | export { |
324 | checkDirectoryIsEmpty, | 330 | checkDirectoryIsEmpty, |
325 | checkTmpIsEmpty, | 331 | checkTmpIsEmpty, |
332 | getServerFileSize, | ||
326 | ServerInfo, | 333 | ServerInfo, |
327 | parallelTests, | 334 | parallelTests, |
328 | cleanupTests, | 335 | cleanupTests, |