diff options
author | Chocobozzz <me@florianbigard.com> | 2021-07-16 09:47:51 +0200 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-07-20 15:27:18 +0200 |
commit | 254d3579f5338f5fd775c17d15cdfc37078bcfb4 (patch) | |
tree | eaeb13fda16c16e98cd6991d202b0ca6a4cbdb63 /shared/extra-utils/videos | |
parent | 89d241a79c262b9775c233b73cff080043ebb5e6 (diff) | |
download | PeerTube-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.ts | 4 | ||||
-rw-r--r-- | shared/extra-utils/videos/live.ts | 6 | ||||
-rw-r--r-- | shared/extra-utils/videos/streaming-playlists.ts | 8 | ||||
-rw-r--r-- | shared/extra-utils/videos/videos-command.ts | 4 | ||||
-rw-r--r-- | shared/extra-utils/videos/videos.ts | 10 |
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 @@ | |||
1 | import { ServerInfo } from '../server/servers' | 1 | import { PeerTubeServer } from '../server/server' |
2 | 2 | ||
3 | function setDefaultVideoChannel (servers: ServerInfo[]) { | 3 | function 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' | |||
5 | import { pathExists, readdir } from 'fs-extra' | 5 | import { pathExists, readdir } from 'fs-extra' |
6 | import { join } from 'path' | 6 | import { join } from 'path' |
7 | import { buildAbsoluteFixturePath, wait } from '../miscs' | 7 | import { buildAbsoluteFixturePath, wait } from '../miscs' |
8 | import { ServerInfo } from '../server/servers' | 8 | import { PeerTubeServer } from '../server/server' |
9 | 9 | ||
10 | function sendRTMPStream (rtmpBaseUrl: string, streamKey: string, fixtureName = 'video_short.mp4') { | 10 | function 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 | ||
73 | async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) { | 73 | async 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 | ||
79 | async function checkLiveCleanup (server: ServerInfo, videoUUID: string, resolutions: number[] = []) { | 79 | async 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' | |||
2 | import { sha256 } from '@server/helpers/core-utils' | 2 | import { sha256 } from '@server/helpers/core-utils' |
3 | import { HttpStatusCode } from '@shared/core-utils' | 3 | import { HttpStatusCode } from '@shared/core-utils' |
4 | import { VideoStreamingPlaylist } from '@shared/models' | 4 | import { VideoStreamingPlaylist } from '@shared/models' |
5 | import { ServerInfo } from '../server' | 5 | import { PeerTubeServer } from '../server' |
6 | 6 | ||
7 | async function checkSegmentHash (options: { | 7 | async 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 | ||
38 | async function checkLiveSegmentHash (options: { | 38 | async 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 | ||
54 | async function checkResolutionsInMasterPlaylist (options: { | 54 | async 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' |
23 | import { buildAbsoluteFixturePath, wait } from '../miscs' | 23 | import { buildAbsoluteFixturePath, wait } from '../miscs' |
24 | import { unwrapBody } from '../requests' | 24 | import { unwrapBody } from '../requests' |
25 | import { ServerInfo, waitJobs } from '../server' | 25 | import { PeerTubeServer, waitJobs } from '../server' |
26 | import { AbstractCommand, OverrideCommandOptions } from '../shared' | 26 | import { AbstractCommand, OverrideCommandOptions } from '../shared' |
27 | 27 | ||
28 | export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { | 28 | export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile'>> & { |
@@ -33,7 +33,7 @@ export type VideoEdit = Partial<Omit<VideoCreate, 'thumbnailfile' | 'previewfile | |||
33 | 33 | ||
34 | export class VideosCommand extends AbstractCommand { | 34 | export 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 | |||
9 | import { dateIsValid, testImage, webtorrentAdd } from '../miscs' | 9 | import { dateIsValid, testImage, webtorrentAdd } from '../miscs' |
10 | import { makeRawRequest } from '../requests/requests' | 10 | import { makeRawRequest } from '../requests/requests' |
11 | import { waitJobs } from '../server' | 11 | import { waitJobs } from '../server' |
12 | import { ServerInfo } from '../server/servers' | 12 | import { PeerTubeServer } from '../server/server' |
13 | import { VideoEdit } from './videos-command' | 13 | import { VideoEdit } from './videos-command' |
14 | 14 | ||
15 | async function checkVideoFilesWereRemoved ( | 15 | async 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 | ||
42 | function checkUploadVideoParam ( | 42 | function 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 | ||
54 | async function completeVideoCheck ( | 54 | async 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 |
199 | async function uploadRandomVideoOnServers ( | 199 | async 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 | ) { |