aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:47:51 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit254d3579f5338f5fd775c17d15cdfc37078bcfb4 (patch)
treeeaeb13fda16c16e98cd6991d202b0ca6a4cbdb63 /shared/extra-utils/videos
parent89d241a79c262b9775c233b73cff080043ebb5e6 (diff)
downloadPeerTube-254d3579f5338f5fd775c17d15cdfc37078bcfb4.tar.gz
PeerTube-254d3579f5338f5fd775c17d15cdfc37078bcfb4.tar.zst
PeerTube-254d3579f5338f5fd775c17d15cdfc37078bcfb4.zip
Use an object to represent a server
Diffstat (limited to 'shared/extra-utils/videos')
-rw-r--r--shared/extra-utils/videos/channels.ts4
-rw-r--r--shared/extra-utils/videos/live.ts6
-rw-r--r--shared/extra-utils/videos/streaming-playlists.ts8
-rw-r--r--shared/extra-utils/videos/videos-command.ts4
-rw-r--r--shared/extra-utils/videos/videos.ts10
5 files changed, 16 insertions, 16 deletions
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 @@
1import { ServerInfo } from '../server/servers' 1import { PeerTubeServer } from '../server/server'
2 2
3function setDefaultVideoChannel (servers: ServerInfo[]) { 3function setDefaultVideoChannel (servers: PeerTubeServer[]) {
4 const tasks: Promise<any>[] = [] 4 const tasks: Promise<any>[] = []
5 5
6 for (const server of servers) { 6 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'
5import { pathExists, readdir } from 'fs-extra' 5import { pathExists, readdir } from 'fs-extra'
6import { join } from 'path' 6import { join } from 'path'
7import { buildAbsoluteFixturePath, wait } from '../miscs' 7import { buildAbsoluteFixturePath, wait } from '../miscs'
8import { ServerInfo } from '../server/servers' 8import { PeerTubeServer } from '../server/server'
9 9
10function sendRTMPStream (rtmpBaseUrl: string, streamKey: string, fixtureName = 'video_short.mp4') { 10function sendRTMPStream (rtmpBaseUrl: string, streamKey: string, fixtureName = 'video_short.mp4') {
11 const fixture = buildAbsoluteFixturePath(fixtureName) 11 const fixture = buildAbsoluteFixturePath(fixtureName)
@@ -70,13 +70,13 @@ async function stopFfmpeg (command: ffmpeg.FfmpegCommand) {
70 await wait(500) 70 await wait(500)
71} 71}
72 72
73async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) { 73async function waitUntilLivePublishedOnAllServers (servers: PeerTubeServer[], videoId: string) {
74 for (const server of servers) { 74 for (const server of servers) {
75 await server.live.waitUntilPublished({ videoId }) 75 await server.live.waitUntilPublished({ videoId })
76 } 76 }
77} 77}
78 78
79async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) { 79async function checkLiveCleanup (server: PeerTubeServer, videoUUID: string, resolutions: number[] = []) {
80 const basePath = server.servers.buildDirectory('streaming-playlists') 80 const basePath = server.servers.buildDirectory('streaming-playlists')
81 const hlsPath = join(basePath, 'hls', videoUUID) 81 const hlsPath = join(basePath, 'hls', videoUUID)
82 82
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'
2import { sha256 } from '@server/helpers/core-utils' 2import { sha256 } from '@server/helpers/core-utils'
3import { HttpStatusCode } from '@shared/core-utils' 3import { HttpStatusCode } from '@shared/core-utils'
4import { VideoStreamingPlaylist } from '@shared/models' 4import { VideoStreamingPlaylist } from '@shared/models'
5import { ServerInfo } from '../server' 5import { PeerTubeServer } from '../server'
6 6
7async function checkSegmentHash (options: { 7async function checkSegmentHash (options: {
8 server: ServerInfo 8 server: PeerTubeServer
9 baseUrlPlaylist: string 9 baseUrlPlaylist: string
10 baseUrlSegment: string 10 baseUrlSegment: string
11 videoUUID: string 11 videoUUID: string
@@ -36,7 +36,7 @@ async function checkSegmentHash (options: {
36} 36}
37 37
38async function checkLiveSegmentHash (options: { 38async function checkLiveSegmentHash (options: {
39 server: ServerInfo 39 server: PeerTubeServer
40 baseUrlSegment: string 40 baseUrlSegment: string
41 videoUUID: string 41 videoUUID: string
42 segmentName: string 42 segmentName: string
@@ -52,7 +52,7 @@ async function checkLiveSegmentHash (options: {
52} 52}
53 53
54async function checkResolutionsInMasterPlaylist (options: { 54async function checkResolutionsInMasterPlaylist (options: {
55 server: ServerInfo 55 server: PeerTubeServer
56 playlistUrl: string 56 playlistUrl: string
57 resolutions: number[] 57 resolutions: number[]
58}) { 58}) {
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 {
22} from '@shared/models' 22} from '@shared/models'
23import { buildAbsoluteFixturePath, wait } from '../miscs' 23import { buildAbsoluteFixturePath, wait } from '../miscs'
24import { unwrapBody } from '../requests' 24import { unwrapBody } from '../requests'
25import { ServerInfo, waitJobs } from '../server' 25import { PeerTubeServer, waitJobs } from '../server'
26import { AbstractCommand, OverrideCommandOptions } from '../shared' 26import { AbstractCommand, OverrideCommandOptions } from '../shared'
27 27
28export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { 28export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & {
@@ -33,7 +33,7 @@ export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile
33 33
34export class VideosCommand extends AbstractCommand { 34export class VideosCommand extends AbstractCommand {
35 35
36 constructor (server: ServerInfo) { 36 constructor (server: PeerTubeServer) {
37 super(server) 37 super(server)
38 38
39 loadLanguages() 39 loadLanguages()
diff --git a/shared/extra-utils/videos/videos.ts b/shared/extra-utils/videos/videos.ts
index 86f49384d..b41533808 100644
--- a/shared/extra-utils/videos/videos.ts
+++ b/shared/extra-utils/videos/videos.ts
@@ -9,12 +9,12 @@ import { VIDEO_CATEGORIES, VIDEO_LANGUAGES, VIDEO_LICENCES, VIDEO_PRIVACIES } fr
9import { dateIsValid, testImage, webtorrentAdd } from '../miscs' 9import { dateIsValid, testImage, webtorrentAdd } from '../miscs'
10import { makeRawRequest } from '../requests/requests' 10import { makeRawRequest } from '../requests/requests'
11import { waitJobs } from '../server' 11import { waitJobs } from '../server'
12import { ServerInfo } from '../server/servers' 12import { PeerTubeServer } from '../server/server'
13import { VideoEdit } from './videos-command' 13import { VideoEdit } from './videos-command'
14 14
15async function checkVideoFilesWereRemoved ( 15async function checkVideoFilesWereRemoved (
16 videoUUID: string, 16 videoUUID: string,
17 server: ServerInfo, 17 server: PeerTubeServer,
18 directories = [ 18 directories = [
19 'redundancy', 19 'redundancy',
20 'videos', 20 'videos',
@@ -40,7 +40,7 @@ async function checkVideoFilesWereRemoved (
40} 40}
41 41
42function checkUploadVideoParam ( 42function checkUploadVideoParam (
43 server: ServerInfo, 43 server: PeerTubeServer,
44 token: string, 44 token: string,
45 attributes: Partial<VideoEdit>, 45 attributes: Partial<VideoEdit>,
46 expectedStatus = HttpStatusCode.OK_200, 46 expectedStatus = HttpStatusCode.OK_200,
@@ -52,7 +52,7 @@ function checkUploadVideoParam (
52} 52}
53 53
54async function completeVideoCheck ( 54async function completeVideoCheck (
55 server: ServerInfo, 55 server: PeerTubeServer,
56 video: any, 56 video: any,
57 attributes: { 57 attributes: {
58 name: string 58 name: string
@@ -197,7 +197,7 @@ async function completeVideoCheck (
197 197
198// serverNumber starts from 1 198// serverNumber starts from 1
199async function uploadRandomVideoOnServers ( 199async function uploadRandomVideoOnServers (
200 servers: ServerInfo[], 200 servers: PeerTubeServer[],
201 serverNumber: number, 201 serverNumber: number,
202 additionalParams?: VideoEdit & { prefixName?: string } 202 additionalParams?: VideoEdit & { prefixName?: string }
203) { 203) {