diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-22 14:28:03 +0200 |
---|---|---|
committer | Chocobozzz <chocobozzz@cpy.re> | 2021-07-26 11:29:31 +0200 |
commit | 83903cb65d531a6b6b91715387493ba8312b264d (patch) | |
tree | fd172e26a483331e74f15a062743a9d40d4016d3 /shared/extra-utils/server/servers-command.ts | |
parent | c4fa01f7c45b66b112ebd08abce744b7c4041feb (diff) | |
download | PeerTube-83903cb65d531a6b6b91715387493ba8312b264d.tar.gz PeerTube-83903cb65d531a6b6b91715387493ba8312b264d.tar.zst PeerTube-83903cb65d531a6b6b91715387493ba8312b264d.zip |
Generate random uuid for video files
Diffstat (limited to 'shared/extra-utils/server/servers-command.ts')
-rw-r--r-- | shared/extra-utils/server/servers-command.ts | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/shared/extra-utils/server/servers-command.ts b/shared/extra-utils/server/servers-command.ts index a78921f2a..441c728c1 100644 --- a/shared/extra-utils/server/servers-command.ts +++ b/shared/extra-utils/server/servers-command.ts | |||
@@ -1,6 +1,7 @@ | |||
1 | import { exec } from 'child_process' | 1 | import { exec } from 'child_process' |
2 | import { copy, ensureDir, readFile, remove } from 'fs-extra' | 2 | import { copy, ensureDir, readFile, remove } from 'fs-extra' |
3 | import { join } from 'path' | 3 | import { join } from 'path' |
4 | import { basename } from 'path/posix' | ||
4 | import { root } from '@server/helpers/core-utils' | 5 | import { root } from '@server/helpers/core-utils' |
5 | import { HttpStatusCode } from '@shared/models' | 6 | import { HttpStatusCode } from '@shared/models' |
6 | import { getFileSize, isGithubCI, wait } from '../miscs' | 7 | import { getFileSize, isGithubCI, wait } from '../miscs' |
@@ -72,6 +73,14 @@ export class ServersCommand extends AbstractCommand { | |||
72 | return join(root(), 'test' + this.server.internalServerNumber, directory) | 73 | return join(root(), 'test' + this.server.internalServerNumber, directory) |
73 | } | 74 | } |
74 | 75 | ||
76 | buildWebTorrentFilePath (fileUrl: string) { | ||
77 | return this.buildDirectory(join('videos', basename(fileUrl))) | ||
78 | } | ||
79 | |||
80 | buildFragmentedFilePath (videoUUID: string, fileUrl: string) { | ||
81 | return this.buildDirectory(join('streaming-playlists', 'hls', videoUUID, basename(fileUrl))) | ||
82 | } | ||
83 | |||
75 | async getServerFileSize (subPath: string) { | 84 | async getServerFileSize (subPath: string) { |
76 | const path = this.server.servers.buildDirectory(subPath) | 85 | const path = this.server.servers.buildDirectory(subPath) |
77 | 86 | ||