From 254d3579f5338f5fd775c17d15cdfc37078bcfb4 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 16 Jul 2021 09:47:51 +0200 Subject: Use an object to represent a server --- shared/extra-utils/videos/channels.ts | 4 ++-- shared/extra-utils/videos/live.ts | 6 +++--- shared/extra-utils/videos/streaming-playlists.ts | 8 ++++---- shared/extra-utils/videos/videos-command.ts | 4 ++-- shared/extra-utils/videos/videos.ts | 10 +++++----- 5 files changed, 16 insertions(+), 16 deletions(-) (limited to 'shared/extra-utils/videos') diff --git a/shared/extra-utils/videos/channels.ts b/shared/extra-utils/videos/channels.ts index 81e818094..756c47453 100644 --- a/shared/extra-utils/videos/channels.ts +++ b/shared/extra-utils/videos/channels.ts @@ -1,6 +1,6 @@ -import { ServerInfo } from '../server/servers' +import { PeerTubeServer } from '../server/server' -function setDefaultVideoChannel (servers: ServerInfo[]) { +function setDefaultVideoChannel (servers: PeerTubeServer[]) { const tasks: Promise[] = [] for (const server of servers) { diff --git a/shared/extra-utils/videos/live.ts b/shared/extra-utils/videos/live.ts index 353595811..502964b1a 100644 --- a/shared/extra-utils/videos/live.ts +++ b/shared/extra-utils/videos/live.ts @@ -5,7 +5,7 @@ import * as ffmpeg from 'fluent-ffmpeg' import { pathExists, readdir } from 'fs-extra' import { join } from 'path' import { buildAbsoluteFixturePath, wait } from '../miscs' -import { ServerInfo } from '../server/servers' +import { PeerTubeServer } from '../server/server' function sendRTMPStream (rtmpBaseUrl: string, streamKey: string, fixtureName = 'video_short.mp4') { const fixture = buildAbsoluteFixturePath(fixtureName) @@ -70,13 +70,13 @@ async function stopFfmpeg (command: ffmpeg.FfmpegCommand) { await wait(500) } -async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) { +async function waitUntilLivePublishedOnAllServers (servers: PeerTubeServer[], videoId: string) { for (const server of servers) { await server.live.waitUntilPublished({ videoId }) } } -async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) { +async function checkLiveCleanup (server: PeerTubeServer, videoUUID: string, resolutions: number[] = []) { const basePath = server.servers.buildDirectory('streaming-playlists') const hlsPath = join(basePath, 'hls', videoUUID) diff --git a/shared/extra-utils/videos/streaming-playlists.ts b/shared/extra-utils/videos/streaming-playlists.ts index e8fd2f232..002ae08b2 100644 --- a/shared/extra-utils/videos/streaming-playlists.ts +++ b/shared/extra-utils/videos/streaming-playlists.ts @@ -2,10 +2,10 @@ import { expect } from 'chai' import { sha256 } from '@server/helpers/core-utils' import { HttpStatusCode } from '@shared/core-utils' import { VideoStreamingPlaylist } from '@shared/models' -import { ServerInfo } from '../server' +import { PeerTubeServer } from '../server' async function checkSegmentHash (options: { - server: ServerInfo + server: PeerTubeServer baseUrlPlaylist: string baseUrlSegment: string videoUUID: string @@ -36,7 +36,7 @@ async function checkSegmentHash (options: { } async function checkLiveSegmentHash (options: { - server: ServerInfo + server: PeerTubeServer baseUrlSegment: string videoUUID: string segmentName: string @@ -52,7 +52,7 @@ async function checkLiveSegmentHash (options: { } async function checkResolutionsInMasterPlaylist (options: { - server: ServerInfo + server: PeerTubeServer playlistUrl: string resolutions: number[] }) { diff --git a/shared/extra-utils/videos/videos-command.ts b/shared/extra-utils/videos/videos-command.ts index 5556cddf6..feef5a771 100644 --- a/shared/extra-utils/videos/videos-command.ts +++ b/shared/extra-utils/videos/videos-command.ts @@ -22,7 +22,7 @@ import { } from '@shared/models' import { buildAbsoluteFixturePath, wait } from '../miscs' import { unwrapBody } from '../requests' -import { ServerInfo, waitJobs } from '../server' +import { PeerTubeServer, waitJobs } from '../server' import { AbstractCommand, OverrideCommandOptions } from '../shared' export type VideoEdit = Partial> & { @@ -33,7 +33,7 @@ export type VideoEdit = Partial, expectedStatus = HttpStatusCode.OK_200, @@ -52,7 +52,7 @@ function checkUploadVideoParam ( } async function completeVideoCheck ( - server: ServerInfo, + server: PeerTubeServer, video: any, attributes: { name: string @@ -197,7 +197,7 @@ async function completeVideoCheck ( // serverNumber starts from 1 async function uploadRandomVideoOnServers ( - servers: ServerInfo[], + servers: PeerTubeServer[], serverNumber: number, additionalParams?: VideoEdit & { prefixName?: string } ) { -- cgit v1.2.3