aboutsummaryrefslogtreecommitdiffhomepage
path: root/shared/extra-utils/videos
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-07-16 09:04:35 +0200
committerChocobozzz <me@florianbigard.com>2021-07-20 15:27:18 +0200
commit89d241a79c262b9775c233b73cff080043ebb5e6 (patch)
treecb3b6cb431d25d891ef4e02f66c61d252d17048f /shared/extra-utils/videos
parentd23dd9fbfc4d26026352c10f81d2795ceaf2908a (diff)
downloadPeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.gz
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.tar.zst
PeerTube-89d241a79c262b9775c233b73cff080043ebb5e6.zip
Shorter server command names
Diffstat (limited to 'shared/extra-utils/videos')
-rw-r--r--shared/extra-utils/videos/channels.ts4
-rw-r--r--shared/extra-utils/videos/live-command.ts8
-rw-r--r--shared/extra-utils/videos/live.ts4
-rw-r--r--shared/extra-utils/videos/playlists-command.ts2
-rw-r--r--shared/extra-utils/videos/streaming-playlists.ts6
-rw-r--r--shared/extra-utils/videos/videos-command.ts2
-rw-r--r--shared/extra-utils/videos/videos.ts10
7 files changed, 18 insertions, 18 deletions
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[]) {
4 const tasks: Promise<any>[] = [] 4 const tasks: Promise<any>[] = []
5 5
6 for (const server of servers) { 6 for (const server of servers) {
7 const p = server.usersCommand.getMyInfo() 7 const p = server.users.getMyInfo()
8 .then(user => { server.videoChannel = user.videoChannels[0] }) 8 .then(user => { server.store.channel = user.videoChannels[0] })
9 9
10 tasks.push(p) 10 tasks.push(p)
11 } 11 }
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 {
114 const { resolution, segment, videoUUID } = options 114 const { resolution, segment, videoUUID } = options
115 const segmentName = `${resolution}-00000${segment}.ts` 115 const segmentName = `${resolution}-00000${segment}.ts`
116 116
117 return this.server.serversCommand.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false) 117 return this.server.servers.waitUntilLog(`${videoUUID}/${segmentName}`, 2, false)
118 } 118 }
119 119
120 async waitUntilSaved (options: OverrideCommandOptions & { 120 async waitUntilSaved (options: OverrideCommandOptions & {
@@ -123,7 +123,7 @@ export class LiveCommand extends AbstractCommand {
123 let video: VideoDetails 123 let video: VideoDetails
124 124
125 do { 125 do {
126 video = await this.server.videosCommand.getWithToken({ token: options.token, id: options.videoId }) 126 video = await this.server.videos.getWithToken({ token: options.token, id: options.videoId })
127 127
128 await wait(500) 128 await wait(500)
129 } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED) 129 } while (video.isLive === true && video.state.id !== VideoState.PUBLISHED)
@@ -132,7 +132,7 @@ export class LiveCommand extends AbstractCommand {
132 async countPlaylists (options: OverrideCommandOptions & { 132 async countPlaylists (options: OverrideCommandOptions & {
133 videoUUID: string 133 videoUUID: string
134 }) { 134 }) {
135 const basePath = this.server.serversCommand.buildDirectory('streaming-playlists') 135 const basePath = this.server.servers.buildDirectory('streaming-playlists')
136 const hlsPath = join(basePath, 'hls', options.videoUUID) 136 const hlsPath = join(basePath, 'hls', options.videoUUID)
137 137
138 const files = await readdir(hlsPath) 138 const files = await readdir(hlsPath)
@@ -147,7 +147,7 @@ export class LiveCommand extends AbstractCommand {
147 let video: VideoDetails 147 let video: VideoDetails
148 148
149 do { 149 do {
150 video = await this.server.videosCommand.getWithToken({ token: options.token, id: options.videoId }) 150 video = await this.server.videos.getWithToken({ token: options.token, id: options.videoId })
151 151
152 await wait(500) 152 await wait(500)
153 } while (video.state.id !== options.state) 153 } 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) {
72 72
73async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) { 73async function waitUntilLivePublishedOnAllServers (servers: ServerInfo[], videoId: string) {
74 for (const server of servers) { 74 for (const server of servers) {
75 await server.liveCommand.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: ServerInfo, videoUUID: string, resolutions: number[] = []) {
80 const basePath = server.serversCommand.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
83 if (resolutions.length === 0) { 83 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 {
184 const attributes = { 184 const attributes = {
185 ...options.attributes, 185 ...options.attributes,
186 186
187 videoId: await this.server.videosCommand.getId({ ...options, uuid: options.attributes.videoId }) 187 videoId: await this.server.videos.getId({ ...options, uuid: options.attributes.videoId })
188 } 188 }
189 189
190 const path = '/api/v1/video-playlists/' + options.playlistId + '/videos' 190 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: {
13 hlsPlaylist: VideoStreamingPlaylist 13 hlsPlaylist: VideoStreamingPlaylist
14}) { 14}) {
15 const { server, baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist } = options 15 const { server, baseUrlPlaylist, baseUrlSegment, videoUUID, resolution, hlsPlaylist } = options
16 const command = server.streamingPlaylistsCommand 16 const command = server.streamingPlaylists
17 17
18 const playlist = await command.get({ url: `${baseUrlPlaylist}/${videoUUID}/${resolution}.m3u8` }) 18 const playlist = await command.get({ url: `${baseUrlPlaylist}/${videoUUID}/${resolution}.m3u8` })
19 19
@@ -43,7 +43,7 @@ async function checkLiveSegmentHash (options: {
43 hlsPlaylist: VideoStreamingPlaylist 43 hlsPlaylist: VideoStreamingPlaylist
44}) { 44}) {
45 const { server, baseUrlSegment, videoUUID, segmentName, hlsPlaylist } = options 45 const { server, baseUrlSegment, videoUUID, segmentName, hlsPlaylist } = options
46 const command = server.streamingPlaylistsCommand 46 const command = server.streamingPlaylists
47 47
48 const segmentBody = await command.getSegment({ url: `${baseUrlSegment}/${videoUUID}/${segmentName}` }) 48 const segmentBody = await command.getSegment({ url: `${baseUrlSegment}/${videoUUID}/${segmentName}` })
49 const shaBody = await command.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url }) 49 const shaBody = await command.getSegmentSha256({ url: hlsPlaylist.segmentsSha256Url })
@@ -58,7 +58,7 @@ async function checkResolutionsInMasterPlaylist (options: {
58}) { 58}) {
59 const { server, playlistUrl, resolutions } = options 59 const { server, playlistUrl, resolutions } = options
60 60
61 const masterPlaylist = await server.streamingPlaylistsCommand.get({ url: playlistUrl }) 61 const masterPlaylist = await server.streamingPlaylists.get({ url: playlistUrl })
62 62
63 for (const resolution of resolutions) { 63 for (const resolution of resolutions) {
64 const reg = new RegExp( 64 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 {
336 let defaultChannelId = 1 336 let defaultChannelId = 1
337 337
338 try { 338 try {
339 const { videoChannels } = await this.server.usersCommand.getMyInfo({ token: options.token }) 339 const { videoChannels } = await this.server.users.getMyInfo({ token: options.token })
340 defaultChannelId = videoChannels[0].id 340 defaultChannelId = videoChannels[0].id
341 } catch (e) { /* empty */ } 341 } catch (e) { /* empty */ }
342 342
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 (
27 ] 27 ]
28) { 28) {
29 for (const directory of directories) { 29 for (const directory of directories) {
30 const directoryPath = server.serversCommand.buildDirectory(directory) 30 const directoryPath = server.servers.buildDirectory(directory)
31 31
32 const directoryExists = await pathExists(directoryPath) 32 const directoryExists = await pathExists(directoryPath)
33 if (directoryExists === false) continue 33 if (directoryExists === false) continue
@@ -47,8 +47,8 @@ function checkUploadVideoParam (
47 mode: 'legacy' | 'resumable' = 'legacy' 47 mode: 'legacy' | 'resumable' = 'legacy'
48) { 48) {
49 return mode === 'legacy' 49 return mode === 'legacy'
50 ? server.videosCommand.buildLegacyUpload({ token, attributes, expectedStatus }) 50 ? server.videos.buildLegacyUpload({ token, attributes, expectedStatus })
51 : server.videosCommand.buildResumeUpload({ token, attributes, expectedStatus }) 51 : server.videos.buildResumeUpload({ token, attributes, expectedStatus })
52} 52}
53 53
54async function completeVideoCheck ( 54async function completeVideoCheck (
@@ -131,7 +131,7 @@ async function completeVideoCheck (
131 expect(video.originallyPublishedAt).to.be.null 131 expect(video.originallyPublishedAt).to.be.null
132 } 132 }
133 133
134 const videoDetails = await server.videosCommand.get({ id: video.uuid }) 134 const videoDetails = await server.videos.get({ id: video.uuid })
135 135
136 expect(videoDetails.files).to.have.lengthOf(attributes.files.length) 136 expect(videoDetails.files).to.have.lengthOf(attributes.files.length)
137 expect(videoDetails.tags).to.deep.equal(attributes.tags) 137 expect(videoDetails.tags).to.deep.equal(attributes.tags)
@@ -202,7 +202,7 @@ async function uploadRandomVideoOnServers (
202 additionalParams?: VideoEdit & { prefixName?: string } 202 additionalParams?: VideoEdit & { prefixName?: string }
203) { 203) {
204 const server = servers.find(s => s.serverNumber === serverNumber) 204 const server = servers.find(s => s.serverNumber === serverNumber)
205 const res = await server.videosCommand.randomUpload({ wait: false, ...additionalParams }) 205 const res = await server.videos.randomUpload({ wait: false, ...additionalParams })
206 206
207 await waitJobs(servers) 207 await waitJobs(servers)
208 208