X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=shared%2Fextra-utils%2Fserver%2Fservers-command.ts;h=776d2123c20aba0757080e176ca7a9f9590cc211;hb=221ee1adc916684d4881d2a9c4c01954dcde986e;hp=107e2b4ad38df5aaff3b9789e1277fb49944f378;hpb=c0e8b12e7fd554ba4d2ceb0c4900804c6a4c63ea;p=github%2FChocobozzz%2FPeerTube.git diff --git a/shared/extra-utils/server/servers-command.ts b/shared/extra-utils/server/servers-command.ts index 107e2b4ad..776d2123c 100644 --- a/shared/extra-utils/server/servers-command.ts +++ b/shared/extra-utils/server/servers-command.ts @@ -1,10 +1,9 @@ import { exec } from 'child_process' import { copy, ensureDir, readFile, remove } from 'fs-extra' -import { join } from 'path' +import { basename, join } from 'path' import { root } from '@server/helpers/core-utils' import { HttpStatusCode } from '@shared/models' -import { getFileSize } from '@uploadx/core' -import { isGithubCI, wait } from '../miscs' +import { getFileSize, isGithubCI, wait } from '../miscs' import { AbstractCommand, OverrideCommandOptions } from '../shared' export class ServersCommand extends AbstractCommand { @@ -56,7 +55,7 @@ export class ServersCommand extends AbstractCommand { } async waitUntilLog (str: string, count = 1, strictCount = true) { - const logfile = this.server.servers.buildDirectory('logs/peertube.log') + const logfile = this.buildDirectory('logs/peertube.log') while (true) { const buf = await readFile(logfile) @@ -73,6 +72,18 @@ export class ServersCommand extends AbstractCommand { return join(root(), 'test' + this.server.internalServerNumber, directory) } + buildWebTorrentFilePath (fileUrl: string) { + return this.buildDirectory(join('videos', basename(fileUrl))) + } + + buildFragmentedFilePath (videoUUID: string, fileUrl: string) { + return this.buildDirectory(join('streaming-playlists', 'hls', videoUUID, basename(fileUrl))) + } + + getLogContent () { + return readFile(this.buildDirectory('logs/peertube.log')) + } + async getServerFileSize (subPath: string) { const path = this.server.servers.buildDirectory(subPath)