]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/server/servers-command.ts
Rename jobs list command
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / server / servers-command.ts
index 9ef68fede652fc901c3ef4ef8885198dda86e778..776d2123c20aba0757080e176ca7a9f9590cc211 100644 (file)
@@ -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/core-utils'
-import { getFileSize } from '@uploadx/core'
-import { isGithubCI, wait } from '../miscs'
+import { HttpStatusCode } from '@shared/models'
+import { getFileSize, isGithubCI, wait } from '../miscs'
 import { AbstractCommand, OverrideCommandOptions } from '../shared'
 
 export class ServersCommand extends AbstractCommand {
@@ -37,7 +36,7 @@ export class ServersCommand extends AbstractCommand {
     if (isGithubCI()) {
       await ensureDir('artifacts')
 
-      const origin = this.server.serversCommand.buildDirectory('logs/peertube.log')
+      const origin = this.buildDirectory('logs/peertube.log')
       const destname = `peertube-${this.server.internalServerNumber}.log`
       console.log('Saving logs %s.', destname)
 
@@ -56,7 +55,7 @@ export class ServersCommand extends AbstractCommand {
   }
 
   async waitUntilLog (str: string, count = 1, strictCount = true) {
-    const logfile = this.server.serversCommand.buildDirectory('logs/peertube.log')
+    const logfile = this.buildDirectory('logs/peertube.log')
 
     while (true) {
       const buf = await readFile(logfile)
@@ -73,8 +72,20 @@ 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.serversCommand.buildDirectory(subPath)
+    const path = this.server.servers.buildDirectory(subPath)
 
     return getFileSize(path)
   }