From d218e7de9400938ae6ac593d9ae5842e23abd4f0 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 20 Nov 2020 15:06:56 +0100 Subject: Do not transcode to an higher bitrate Thanks bkil https://github.com/bkil --- shared/extra-utils/miscs/miscs.ts | 9 ++++++++- shared/extra-utils/server/servers.ts | 9 ++++++++- 2 files changed, 16 insertions(+), 2 deletions(-) (limited to 'shared/extra-utils') 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' import { basename, dirname, isAbsolute, join, resolve } from 'path' import * as request from 'supertest' import * as WebTorrent from 'webtorrent' -import { ensureDir, pathExists, readFile } from 'fs-extra' +import { ensureDir, pathExists, readFile, stat } from 'fs-extra' import * as ffmpeg from 'fluent-ffmpeg' const expect = chai.expect @@ -130,6 +130,12 @@ async function generateVideoWithFramerate (fps = 60) { return tempFixturePath } +async function getFileSize (path: string) { + const stats = await stat(path) + + return stats.size +} + // --------------------------------------------------------------------------- export { @@ -138,6 +144,7 @@ export { areHttpImportTestsDisabled, buildServerDirectory, webtorrentAdd, + getFileSize, immutableAssign, testImage, 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' import { join } from 'path' import { randomInt } from '../../core-utils/miscs/miscs' import { VideoChannel } from '../../models/videos' -import { root, wait } from '../miscs/miscs' +import { getFileSize, root, wait } from '../miscs/miscs' interface ServerInfo { app: ChildProcess @@ -318,11 +318,18 @@ async function waitUntilLog (server: ServerInfo, str: string, count = 1, strictC } } +async function getServerFileSize (server: ServerInfo, subPath: string) { + const path = join(root(), 'test' + server.internalServerNumber, subPath) + + return getFileSize(path) +} + // --------------------------------------------------------------------------- export { checkDirectoryIsEmpty, checkTmpIsEmpty, + getServerFileSize, ServerInfo, parallelTests, cleanupTests, -- cgit v1.2.3