From 89d241a79c262b9775c233b73cff080043ebb5e6 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 09:04:35 +0200 Subject: Shorter server command names --- shared/extra-utils/videos/channels.ts | 4 ++-- shared/extra-utils/videos/live-command.ts | 8 ++++---- shared/extra-utils/videos/live.ts | 4 ++-- shared/extra-utils/videos/playlists-command.ts | 2 +- shared/extra-utils/videos/streaming-playlists.ts | 6 +++--- shared/extra-utils/videos/videos-command.ts | 2 +- shared/extra-utils/videos/videos.ts | 10 +++++----- 7 files changed, 18 insertions(+), 18 deletions(-) (limited to 'shared/extra-utils/videos') diff --git a/shared/extra-utils/videos/channels.ts b/shared/extra-utils/videos/channels.ts index 9e7ec565d..81e818094 100644 --- a/shared/extra-utils/videos/channels.ts +++ b/shared/extra-utils/videos/channels.ts @@ -4,8 +4,8 @@ function setDefaultVideoChannel (servers: ServerInfo[]) { const tasks: Promise[] = [] for (const server of servers) { - const p = server.usersCommand.getMyInfo() - .then(user => { server.videoChannel = user.videoChannels[0] }) + const p = server.users.getMyInfo() + .then(user => { server.store.channel = user.videoChannels[0] }) tasks.push(p) } diff --git a/shared/extra-utils/videos/live-command.ts b/shared/extra-utils/videos/live-command.ts index 5adf601cc..fd66c9924 100644 --- a/shared/extra-utils/videos/live-command.ts +++ b/shared/extra-utils/videos/live-command.ts @@ -114,7 +114,7 @@ export class LiveCommand extends AbstractCommand { const { resolution, segment, videoUUID } = options const segmentName = `${resolution}-00000${segment}.ts` - return this.server.serversCommand.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false) + return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false) } async waitUntilSaved (options: OverrideCommandOptions & { @@ -123,7 +123,7 @@ export class LiveCommand extends AbstractCommand { let video: VideoDetails do { - video = await this.server.videosCommand.getWithToken({ token: options.token, id: options.videoId }) + video = await this.server.videos.getWithToken({ token: options.token, id: options.videoId }) await wait(500) } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED) @@ -132,7 +132,7 @@ export class LiveCommand extends AbstractCommand { async countPlaylists (options: OverrideCommandOptions & { videoUUID: string }) { - const basePath = this.server.serversCommand.buildDirectory('streaming-playlists') + const basePath = this.server.servers.buildDirectory('streaming-playlists') const hlsPath = join(basePath, 'hls', options.videoUUID) const files = await readdir(hlsPath) @@ -147,7 +147,7 @@ export class LiveCommand extends AbstractCommand { let video: VideoDetails do { - video = await this.server.videosCommand.getWithToken({ token: options.token, id: options.videoId }) + video = await this.server.videos.getWithToken({ token: options.token, id: options.videoId }) await wait(500) } while (video.state.id !== options.state) diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts index 0efcc2883..353595811 100644 --- a/shared/extra-utils/videos/live.ts +++ b/shared/extra-utils/videos/live.ts @@ -72,12 +72,12 @@ async function stopFfmpeg (command: ffmpeg.FfmpegCommand) { async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) { for (const server of servers) { - await server.liveCommand.waitUntilPublished({ videoId }) + await server.live.waitUntilPublished({ videoId }) } } async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) { - const basePath = server.serversCommand.buildDirectory('streaming-playlists') + const basePath = server.servers.buildDirectory('streaming-playlists') const hlsPath = join(basePath, 'hls', videoUUID) if (resolutions.length === 0) { diff --git a/shared/extra-utils/videos/playlists-command.ts b/shared/extra-utils/videos/playlists-command.ts index 75c8f2433..cbfc7e10f 100644 --- a/shared/extra-utils/videos/playlists-command.ts +++ b/shared/extra-utils/videos/playlists-command.ts @@ -184,7 +184,7 @@ export class PlaylistsCommand extends AbstractCommand { const attributes = { ...options.attributes, - videoId: await this.server.videosCommand.getId({ ...options, uuid: options.attributes.videoId }) + videoId: await this.server.videos.getId({ ...options, uuid: options.attributes.videoId }) } const path = '/api/v1/video-playlists/' + options.playlistId + '/videos' diff --git a/shared/extra-utils/videos/streaming-playlists.ts b/shared/extra-utils/videos/streaming-playlists.ts index 0324c739a..e8fd2f232 100644 --- a/shared/extra-utils/videos/streaming-playlists.ts +++ b/shared/extra-utils/videos/streaming-playlists.ts @@ -13,7 +13,7 @@ async function checkSegmentHash (options: { hlsPlaylist: VideoStreamingPlaylist }) { const { server, baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist } = options - const command = server.streamingPlaylistsCommand + const command = server.streamingPlaylists const playlist = await command.get({ url: `${baseUrlPlaylist}/${videoUUID}/${resolution}.m3u8` }) @@ -43,7 +43,7 @@ async function checkLiveSegmentHash (options: { hlsPlaylist: VideoStreamingPlaylist }) { const { server, baseUrlSegment, videoUUID, segmentName, hlsPlaylist } = options - const command = server.streamingPlaylistsCommand + const command = server.streamingPlaylists const segmentBody = await command.getSegment({ url: `${baseUrlSegment}/${videoUUID}/${segmentName}` }) const shaBody = await command.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url }) @@ -58,7 +58,7 @@ async function checkResolutionsInMasterPlaylist (options: { }) { const { server, playlistUrl, resolutions } = options - const masterPlaylist = await server.streamingPlaylistsCommand.get({ url: playlistUrl }) + const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl }) for (const resolution of resolutions) { const reg = new RegExp( diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts index 574705474..5556cddf6 100644 --- a/shared/extra-utils/videos/videos-command.ts +++ b/shared/extra-utils/videos/videos-command.ts @@ -336,7 +336,7 @@ export class VideosCommand extends AbstractCommand { let defaultChannelId = 1 try { - const { videoChannels } = await this.server.usersCommand.getMyInfo({ token: options.token }) + const { videoChannels } = await this.server.users.getMyInfo({ token: options.token }) defaultChannelId = videoChannels[0].id } catch (e) { /* empty */ } diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts index 19f0df8b8..86f49384d 100644 --- a/shared/extra-utils/videos/videos.ts +++ b/shared/extra-utils/videos/videos.ts @@ -27,7 +27,7 @@ async function checkVideoFilesWereRemoved ( ] ) { for (const directory of directories) { - const directoryPath = server.serversCommand.buildDirectory(directory) + const directoryPath = server.servers.buildDirectory(directory) const directoryExists = await pathExists(directoryPath) if (directoryExists === false) continue @@ -47,8 +47,8 @@ function checkUploadVideoParam ( mode: 'legacy' | 'resumable' = 'legacy' ) { return mode === 'legacy' - ? server.videosCommand.buildLegacyUpload({ token, attributes, expectedStatus }) - : server.videosCommand.buildResumeUpload({ token, attributes, expectedStatus }) + ? server.videos.buildLegacyUpload({ token, attributes, expectedStatus }) + : server.videos.buildResumeUpload({ token, attributes, expectedStatus }) } async function completeVideoCheck ( @@ -131,7 +131,7 @@ async function completeVideoCheck ( expect(video.originallyPublishedAt).to.be.null } - const videoDetails = await server.videosCommand.get({ id: video.uuid }) + const videoDetails = await server.videos.get({ id: video.uuid }) expect(videoDetails.files).to.have.lengthOf(attributes.files.length) expect(videoDetails.tags).to.deep.equal(attributes.tags) @@ -202,7 +202,7 @@ async function uploadRandomVideoOnServers ( additionalParams?: VideoEdit & { prefixName?: string } ) { const server = servers.find(s => s.serverNumber === serverNumber) - const res = await server.videosCommand.randomUpload({ wait: false, ...additionalParams }) + const res = await server.videos.randomUpload({ wait: false, ...additionalParams }) await waitJobs(servers) -- cgit v1.2.3