diff options
Diffstat (limited to 'server/tests/api/videos/video-transcoder.ts')
-rw-r--r-- | server/tests/api/videos/video-transcoder.ts | 122 |
1 files changed, 61 insertions, 61 deletions
diff --git a/server/tests/api/videos/video-transcoder.ts b/server/tests/api/videos/video-transcoder.ts index b41c68283..37450eeeb 100644 --- a/server/tests/api/videos/video-transcoder.ts +++ b/server/tests/api/videos/video-transcoder.ts | |||
@@ -32,7 +32,7 @@ import { | |||
32 | const expect = chai.expect | 32 | const expect = chai.expect |
33 | 33 | ||
34 | function updateConfigForTranscoding (server: ServerInfo) { | 34 | function updateConfigForTranscoding (server: ServerInfo) { |
35 | return server.configCommand.updateCustomSubConfig({ | 35 | return server.config.updateCustomSubConfig({ |
36 | newConfig: { | 36 | newConfig: { |
37 | transcoding: { | 37 | transcoding: { |
38 | enabled: true, | 38 | enabled: true, |
@@ -82,15 +82,15 @@ describe('Test video transcoding', function () { | |||
82 | description: 'my super description for server 1', | 82 | description: 'my super description for server 1', |
83 | fixture: 'video_short.webm' | 83 | fixture: 'video_short.webm' |
84 | } | 84 | } |
85 | await servers[0].videosCommand.upload({ attributes }) | 85 | await servers[0].videos.upload({ attributes }) |
86 | 86 | ||
87 | await waitJobs(servers) | 87 | await waitJobs(servers) |
88 | 88 | ||
89 | for (const server of servers) { | 89 | for (const server of servers) { |
90 | const { data } = await server.videosCommand.list() | 90 | const { data } = await server.videos.list() |
91 | const video = data[0] | 91 | const video = data[0] |
92 | 92 | ||
93 | const videoDetails = await server.videosCommand.get({ id: video.id }) | 93 | const videoDetails = await server.videos.get({ id: video.id }) |
94 | expect(videoDetails.files).to.have.lengthOf(1) | 94 | expect(videoDetails.files).to.have.lengthOf(1) |
95 | 95 | ||
96 | const magnetUri = videoDetails.files[0].magnetUri | 96 | const magnetUri = videoDetails.files[0].magnetUri |
@@ -111,15 +111,15 @@ describe('Test video transcoding', function () { | |||
111 | description: 'my super description for server 2', | 111 | description: 'my super description for server 2', |
112 | fixture: 'video_short.webm' | 112 | fixture: 'video_short.webm' |
113 | } | 113 | } |
114 | await servers[1].videosCommand.upload({ attributes }) | 114 | await servers[1].videos.upload({ attributes }) |
115 | 115 | ||
116 | await waitJobs(servers) | 116 | await waitJobs(servers) |
117 | 117 | ||
118 | for (const server of servers) { | 118 | for (const server of servers) { |
119 | const { data } = await server.videosCommand.list() | 119 | const { data } = await server.videos.list() |
120 | 120 | ||
121 | const video = data.find(v => v.name === attributes.name) | 121 | const video = data.find(v => v.name === attributes.name) |
122 | const videoDetails = await server.videosCommand.get({ id: video.id }) | 122 | const videoDetails = await server.videos.get({ id: video.id }) |
123 | 123 | ||
124 | expect(videoDetails.files).to.have.lengthOf(4) | 124 | expect(videoDetails.files).to.have.lengthOf(4) |
125 | 125 | ||
@@ -143,11 +143,11 @@ describe('Test video transcoding', function () { | |||
143 | fixture: 'video_short1.webm', | 143 | fixture: 'video_short1.webm', |
144 | waitTranscoding: true | 144 | waitTranscoding: true |
145 | } | 145 | } |
146 | const { uuid } = await servers[1].videosCommand.upload({ attributes }) | 146 | const { uuid } = await servers[1].videos.upload({ attributes }) |
147 | const videoId = uuid | 147 | const videoId = uuid |
148 | 148 | ||
149 | // Should be in transcode state | 149 | // Should be in transcode state |
150 | const body = await servers[1].videosCommand.get({ id: videoId }) | 150 | const body = await servers[1].videos.get({ id: videoId }) |
151 | expect(body.name).to.equal('waiting video') | 151 | expect(body.name).to.equal('waiting video') |
152 | expect(body.state.id).to.equal(VideoState.TO_TRANSCODE) | 152 | expect(body.state.id).to.equal(VideoState.TO_TRANSCODE) |
153 | expect(body.state.label).to.equal('To transcode') | 153 | expect(body.state.label).to.equal('To transcode') |
@@ -155,7 +155,7 @@ describe('Test video transcoding', function () { | |||
155 | 155 | ||
156 | { | 156 | { |
157 | // Should have my video | 157 | // Should have my video |
158 | const { data } = await servers[1].videosCommand.listMyVideos() | 158 | const { data } = await servers[1].videos.listMyVideos() |
159 | const videoToFindInMine = data.find(v => v.name === attributes.name) | 159 | const videoToFindInMine = data.find(v => v.name === attributes.name) |
160 | expect(videoToFindInMine).not.to.be.undefined | 160 | expect(videoToFindInMine).not.to.be.undefined |
161 | expect(videoToFindInMine.state.id).to.equal(VideoState.TO_TRANSCODE) | 161 | expect(videoToFindInMine.state.id).to.equal(VideoState.TO_TRANSCODE) |
@@ -165,23 +165,23 @@ describe('Test video transcoding', function () { | |||
165 | 165 | ||
166 | { | 166 | { |
167 | // Should not list this video | 167 | // Should not list this video |
168 | const { data } = await servers[1].videosCommand.list() | 168 | const { data } = await servers[1].videos.list() |
169 | const videoToFindInList = data.find(v => v.name === attributes.name) | 169 | const videoToFindInList = data.find(v => v.name === attributes.name) |
170 | expect(videoToFindInList).to.be.undefined | 170 | expect(videoToFindInList).to.be.undefined |
171 | } | 171 | } |
172 | 172 | ||
173 | // Server 1 should not have the video yet | 173 | // Server 1 should not have the video yet |
174 | await servers[0].videosCommand.get({ id: videoId, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) | 174 | await servers[0].videos.get({ id: videoId, expectedStatus: HttpStatusCode.NOT_FOUND_404 }) |
175 | } | 175 | } |
176 | 176 | ||
177 | await waitJobs(servers) | 177 | await waitJobs(servers) |
178 | 178 | ||
179 | for (const server of servers) { | 179 | for (const server of servers) { |
180 | const { data } = await server.videosCommand.list() | 180 | const { data } = await server.videos.list() |
181 | const videoToFind = data.find(v => v.name === 'waiting video') | 181 | const videoToFind = data.find(v => v.name === 'waiting video') |
182 | expect(videoToFind).not.to.be.undefined | 182 | expect(videoToFind).not.to.be.undefined |
183 | 183 | ||
184 | const videoDetails = await server.videosCommand.get({ id: videoToFind.id }) | 184 | const videoDetails = await server.videos.get({ id: videoToFind.id }) |
185 | 185 | ||
186 | expect(videoDetails.state.id).to.equal(VideoState.PUBLISHED) | 186 | expect(videoDetails.state.id).to.equal(VideoState.PUBLISHED) |
187 | expect(videoDetails.state.label).to.equal('Published') | 187 | expect(videoDetails.state.label).to.equal('Published') |
@@ -207,15 +207,15 @@ describe('Test video transcoding', function () { | |||
207 | fixture | 207 | fixture |
208 | } | 208 | } |
209 | 209 | ||
210 | await servers[1].videosCommand.upload({ attributes }) | 210 | await servers[1].videos.upload({ attributes }) |
211 | 211 | ||
212 | await waitJobs(servers) | 212 | await waitJobs(servers) |
213 | 213 | ||
214 | for (const server of servers) { | 214 | for (const server of servers) { |
215 | const { data } = await server.videosCommand.list() | 215 | const { data } = await server.videos.list() |
216 | 216 | ||
217 | const video = data.find(v => v.name === attributes.name) | 217 | const video = data.find(v => v.name === attributes.name) |
218 | const videoDetails = await server.videosCommand.get({ id: video.id }) | 218 | const videoDetails = await server.videos.get({ id: video.id }) |
219 | expect(videoDetails.files).to.have.lengthOf(4) | 219 | expect(videoDetails.files).to.have.lengthOf(4) |
220 | 220 | ||
221 | const magnetUri = videoDetails.files[0].magnetUri | 221 | const magnetUri = videoDetails.files[0].magnetUri |
@@ -232,7 +232,7 @@ describe('Test video transcoding', function () { | |||
232 | fixture: 'video_short_4k.mp4' | 232 | fixture: 'video_short_4k.mp4' |
233 | } | 233 | } |
234 | 234 | ||
235 | const { uuid } = await servers[1].videosCommand.upload({ attributes }) | 235 | const { uuid } = await servers[1].videos.upload({ attributes }) |
236 | video4k = uuid | 236 | video4k = uuid |
237 | 237 | ||
238 | await waitJobs(servers) | 238 | await waitJobs(servers) |
@@ -240,7 +240,7 @@ describe('Test video transcoding', function () { | |||
240 | const resolutions = [ 240, 360, 480, 720, 1080, 1440, 2160 ] | 240 | const resolutions = [ 240, 360, 480, 720, 1080, 1440, 2160 ] |
241 | 241 | ||
242 | for (const server of servers) { | 242 | for (const server of servers) { |
243 | const videoDetails = await server.videosCommand.get({ id: video4k }) | 243 | const videoDetails = await server.videos.get({ id: video4k }) |
244 | expect(videoDetails.files).to.have.lengthOf(resolutions.length) | 244 | expect(videoDetails.files).to.have.lengthOf(resolutions.length) |
245 | 245 | ||
246 | for (const r of resolutions) { | 246 | for (const r of resolutions) { |
@@ -260,19 +260,19 @@ describe('Test video transcoding', function () { | |||
260 | name: 'mp3_256k', | 260 | name: 'mp3_256k', |
261 | fixture: 'video_short_mp3_256k.mp4' | 261 | fixture: 'video_short_mp3_256k.mp4' |
262 | } | 262 | } |
263 | await servers[1].videosCommand.upload({ attributes }) | 263 | await servers[1].videos.upload({ attributes }) |
264 | 264 | ||
265 | await waitJobs(servers) | 265 | await waitJobs(servers) |
266 | 266 | ||
267 | for (const server of servers) { | 267 | for (const server of servers) { |
268 | const { data } = await server.videosCommand.list() | 268 | const { data } = await server.videos.list() |
269 | 269 | ||
270 | const video = data.find(v => v.name === attributes.name) | 270 | const video = data.find(v => v.name === attributes.name) |
271 | const videoDetails = await server.videosCommand.get({ id: video.id }) | 271 | const videoDetails = await server.videos.get({ id: video.id }) |
272 | 272 | ||
273 | expect(videoDetails.files).to.have.lengthOf(4) | 273 | expect(videoDetails.files).to.have.lengthOf(4) |
274 | 274 | ||
275 | const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4')) | 275 | const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-240.mp4')) |
276 | const probe = await getAudioStream(path) | 276 | const probe = await getAudioStream(path) |
277 | 277 | ||
278 | if (probe.audioStream) { | 278 | if (probe.audioStream) { |
@@ -291,18 +291,18 @@ describe('Test video transcoding', function () { | |||
291 | name: 'no_audio', | 291 | name: 'no_audio', |
292 | fixture: 'video_short_no_audio.mp4' | 292 | fixture: 'video_short_no_audio.mp4' |
293 | } | 293 | } |
294 | await servers[1].videosCommand.upload({ attributes }) | 294 | await servers[1].videos.upload({ attributes }) |
295 | 295 | ||
296 | await waitJobs(servers) | 296 | await waitJobs(servers) |
297 | 297 | ||
298 | for (const server of servers) { | 298 | for (const server of servers) { |
299 | const { data } = await server.videosCommand.list() | 299 | const { data } = await server.videos.list() |
300 | 300 | ||
301 | const video = data.find(v => v.name === attributes.name) | 301 | const video = data.find(v => v.name === attributes.name) |
302 | const videoDetails = await server.videosCommand.get({ id: video.id }) | 302 | const videoDetails = await server.videos.get({ id: video.id }) |
303 | 303 | ||
304 | expect(videoDetails.files).to.have.lengthOf(4) | 304 | expect(videoDetails.files).to.have.lengthOf(4) |
305 | const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4')) | 305 | const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-240.mp4')) |
306 | const probe = await getAudioStream(path) | 306 | const probe = await getAudioStream(path) |
307 | expect(probe).to.not.have.property('audioStream') | 307 | expect(probe).to.not.have.property('audioStream') |
308 | } | 308 | } |
@@ -315,21 +315,21 @@ describe('Test video transcoding', function () { | |||
315 | name: 'untouched_audio', | 315 | name: 'untouched_audio', |
316 | fixture: 'video_short.mp4' | 316 | fixture: 'video_short.mp4' |
317 | } | 317 | } |
318 | await servers[1].videosCommand.upload({ attributes }) | 318 | await servers[1].videos.upload({ attributes }) |
319 | 319 | ||
320 | await waitJobs(servers) | 320 | await waitJobs(servers) |
321 | 321 | ||
322 | for (const server of servers) { | 322 | for (const server of servers) { |
323 | const { data } = await server.videosCommand.list() | 323 | const { data } = await server.videos.list() |
324 | 324 | ||
325 | const video = data.find(v => v.name === attributes.name) | 325 | const video = data.find(v => v.name === attributes.name) |
326 | const videoDetails = await server.videosCommand.get({ id: video.id }) | 326 | const videoDetails = await server.videos.get({ id: video.id }) |
327 | 327 | ||
328 | expect(videoDetails.files).to.have.lengthOf(4) | 328 | expect(videoDetails.files).to.have.lengthOf(4) |
329 | 329 | ||
330 | const fixturePath = buildAbsoluteFixturePath(attributes.fixture) | 330 | const fixturePath = buildAbsoluteFixturePath(attributes.fixture) |
331 | const fixtureVideoProbe = await getAudioStream(fixturePath) | 331 | const fixtureVideoProbe = await getAudioStream(fixturePath) |
332 | const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4')) | 332 | const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-240.mp4')) |
333 | 333 | ||
334 | const videoProbe = await getAudioStream(path) | 334 | const videoProbe = await getAudioStream(path) |
335 | 335 | ||
@@ -348,7 +348,7 @@ describe('Test video transcoding', function () { | |||
348 | function runSuite (mode: 'legacy' | 'resumable') { | 348 | function runSuite (mode: 'legacy' | 'resumable') { |
349 | 349 | ||
350 | before(async function () { | 350 | before(async function () { |
351 | await servers[1].configCommand.updateCustomSubConfig({ | 351 | await servers[1].config.updateCustomSubConfig({ |
352 | newConfig: { | 352 | newConfig: { |
353 | transcoding: { | 353 | transcoding: { |
354 | hls: { enabled: true }, | 354 | hls: { enabled: true }, |
@@ -372,15 +372,15 @@ describe('Test video transcoding', function () { | |||
372 | this.timeout(60_000) | 372 | this.timeout(60_000) |
373 | 373 | ||
374 | const attributes = { name: 'audio_with_preview', previewfile: 'preview.jpg', fixture: 'sample.ogg' } | 374 | const attributes = { name: 'audio_with_preview', previewfile: 'preview.jpg', fixture: 'sample.ogg' } |
375 | await servers[1].videosCommand.upload({ attributes, mode }) | 375 | await servers[1].videos.upload({ attributes, mode }) |
376 | 376 | ||
377 | await waitJobs(servers) | 377 | await waitJobs(servers) |
378 | 378 | ||
379 | for (const server of servers) { | 379 | for (const server of servers) { |
380 | const { data } = await server.videosCommand.list() | 380 | const { data } = await server.videos.list() |
381 | 381 | ||
382 | const video = data.find(v => v.name === 'audio_with_preview') | 382 | const video = data.find(v => v.name === 'audio_with_preview') |
383 | const videoDetails = await server.videosCommand.get({ id: video.id }) | 383 | const videoDetails = await server.videos.get({ id: video.id }) |
384 | 384 | ||
385 | expect(videoDetails.files).to.have.lengthOf(1) | 385 | expect(videoDetails.files).to.have.lengthOf(1) |
386 | 386 | ||
@@ -396,15 +396,15 @@ describe('Test video transcoding', function () { | |||
396 | this.timeout(60_000) | 396 | this.timeout(60_000) |
397 | 397 | ||
398 | const attributes = { name: 'audio_without_preview', fixture: 'sample.ogg' } | 398 | const attributes = { name: 'audio_without_preview', fixture: 'sample.ogg' } |
399 | await servers[1].videosCommand.upload({ attributes, mode }) | 399 | await servers[1].videos.upload({ attributes, mode }) |
400 | 400 | ||
401 | await waitJobs(servers) | 401 | await waitJobs(servers) |
402 | 402 | ||
403 | for (const server of servers) { | 403 | for (const server of servers) { |
404 | const { data } = await server.videosCommand.list() | 404 | const { data } = await server.videos.list() |
405 | 405 | ||
406 | const video = data.find(v => v.name === 'audio_without_preview') | 406 | const video = data.find(v => v.name === 'audio_without_preview') |
407 | const videoDetails = await server.videosCommand.get({ id: video.id }) | 407 | const videoDetails = await server.videos.get({ id: video.id }) |
408 | 408 | ||
409 | expect(videoDetails.files).to.have.lengthOf(1) | 409 | expect(videoDetails.files).to.have.lengthOf(1) |
410 | 410 | ||
@@ -419,7 +419,7 @@ describe('Test video transcoding', function () { | |||
419 | it('Should upload an audio file and create an audio version only', async function () { | 419 | it('Should upload an audio file and create an audio version only', async function () { |
420 | this.timeout(60_000) | 420 | this.timeout(60_000) |
421 | 421 | ||
422 | await servers[1].configCommand.updateCustomSubConfig({ | 422 | await servers[1].config.updateCustomSubConfig({ |
423 | newConfig: { | 423 | newConfig: { |
424 | transcoding: { | 424 | transcoding: { |
425 | hls: { enabled: true }, | 425 | hls: { enabled: true }, |
@@ -434,12 +434,12 @@ describe('Test video transcoding', function () { | |||
434 | }) | 434 | }) |
435 | 435 | ||
436 | const attributes = { name: 'audio_with_preview', previewfile: 'preview.jpg', fixture: 'sample.ogg' } | 436 | const attributes = { name: 'audio_with_preview', previewfile: 'preview.jpg', fixture: 'sample.ogg' } |
437 | const { id } = await servers[1].videosCommand.upload({ attributes, mode }) | 437 | const { id } = await servers[1].videos.upload({ attributes, mode }) |
438 | 438 | ||
439 | await waitJobs(servers) | 439 | await waitJobs(servers) |
440 | 440 | ||
441 | for (const server of servers) { | 441 | for (const server of servers) { |
442 | const videoDetails = await server.videosCommand.get({ id }) | 442 | const videoDetails = await server.videos.get({ id }) |
443 | 443 | ||
444 | for (const files of [ videoDetails.files, videoDetails.streamingPlaylists[0].files ]) { | 444 | for (const files of [ videoDetails.files, videoDetails.streamingPlaylists[0].files ]) { |
445 | expect(files).to.have.lengthOf(2) | 445 | expect(files).to.have.lengthOf(2) |
@@ -470,15 +470,15 @@ describe('Test video transcoding', function () { | |||
470 | description: 'my super 30fps description for server 2', | 470 | description: 'my super 30fps description for server 2', |
471 | fixture: '60fps_720p_small.mp4' | 471 | fixture: '60fps_720p_small.mp4' |
472 | } | 472 | } |
473 | await servers[1].videosCommand.upload({ attributes }) | 473 | await servers[1].videos.upload({ attributes }) |
474 | 474 | ||
475 | await waitJobs(servers) | 475 | await waitJobs(servers) |
476 | 476 | ||
477 | for (const server of servers) { | 477 | for (const server of servers) { |
478 | const { data } = await server.videosCommand.list() | 478 | const { data } = await server.videos.list() |
479 | 479 | ||
480 | const video = data.find(v => v.name === attributes.name) | 480 | const video = data.find(v => v.name === attributes.name) |
481 | const videoDetails = await server.videosCommand.get({ id: video.id }) | 481 | const videoDetails = await server.videos.get({ id: video.id }) |
482 | 482 | ||
483 | expect(videoDetails.files).to.have.lengthOf(4) | 483 | expect(videoDetails.files).to.have.lengthOf(4) |
484 | expect(videoDetails.files[0].fps).to.be.above(58).and.below(62) | 484 | expect(videoDetails.files[0].fps).to.be.above(58).and.below(62) |
@@ -487,13 +487,13 @@ describe('Test video transcoding', function () { | |||
487 | expect(videoDetails.files[3].fps).to.be.below(31) | 487 | expect(videoDetails.files[3].fps).to.be.below(31) |
488 | 488 | ||
489 | for (const resolution of [ '240', '360', '480' ]) { | 489 | for (const resolution of [ '240', '360', '480' ]) { |
490 | const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4')) | 490 | const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4')) |
491 | const fps = await getVideoFileFPS(path) | 491 | const fps = await getVideoFileFPS(path) |
492 | 492 | ||
493 | expect(fps).to.be.below(31) | 493 | expect(fps).to.be.below(31) |
494 | } | 494 | } |
495 | 495 | ||
496 | const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-720.mp4')) | 496 | const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-720.mp4')) |
497 | const fps = await getVideoFileFPS(path) | 497 | const fps = await getVideoFileFPS(path) |
498 | 498 | ||
499 | expect(fps).to.be.above(58).and.below(62) | 499 | expect(fps).to.be.above(58).and.below(62) |
@@ -518,23 +518,23 @@ describe('Test video transcoding', function () { | |||
518 | fixture: tempFixturePath | 518 | fixture: tempFixturePath |
519 | } | 519 | } |
520 | 520 | ||
521 | await servers[1].videosCommand.upload({ attributes }) | 521 | await servers[1].videos.upload({ attributes }) |
522 | 522 | ||
523 | await waitJobs(servers) | 523 | await waitJobs(servers) |
524 | 524 | ||
525 | for (const server of servers) { | 525 | for (const server of servers) { |
526 | const { data } = await server.videosCommand.list() | 526 | const { data } = await server.videos.list() |
527 | 527 | ||
528 | const video = data.find(v => v.name === attributes.name) | 528 | const video = data.find(v => v.name === attributes.name) |
529 | 529 | ||
530 | { | 530 | { |
531 | const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-240.mp4')) | 531 | const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-240.mp4')) |
532 | const fps = await getVideoFileFPS(path) | 532 | const fps = await getVideoFileFPS(path) |
533 | expect(fps).to.be.equal(25) | 533 | expect(fps).to.be.equal(25) |
534 | } | 534 | } |
535 | 535 | ||
536 | { | 536 | { |
537 | const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-720.mp4')) | 537 | const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-720.mp4')) |
538 | const fps = await getVideoFileFPS(path) | 538 | const fps = await getVideoFileFPS(path) |
539 | expect(fps).to.be.equal(59) | 539 | expect(fps).to.be.equal(59) |
540 | } | 540 | } |
@@ -561,17 +561,17 @@ describe('Test video transcoding', function () { | |||
561 | fixture: tempFixturePath | 561 | fixture: tempFixturePath |
562 | } | 562 | } |
563 | 563 | ||
564 | await servers[1].videosCommand.upload({ attributes }) | 564 | await servers[1].videos.upload({ attributes }) |
565 | 565 | ||
566 | await waitJobs(servers) | 566 | await waitJobs(servers) |
567 | 567 | ||
568 | for (const server of servers) { | 568 | for (const server of servers) { |
569 | const { data } = await server.videosCommand.list() | 569 | const { data } = await server.videos.list() |
570 | 570 | ||
571 | const video = data.find(v => v.name === attributes.name) | 571 | const video = data.find(v => v.name === attributes.name) |
572 | 572 | ||
573 | for (const resolution of [ '240', '360', '480', '720', '1080' ]) { | 573 | for (const resolution of [ '240', '360', '480', '720', '1080' ]) { |
574 | const path = servers[1].serversCommand.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4')) | 574 | const path = servers[1].servers.buildDirectory(join('videos', video.uuid + '-' + resolution + '.mp4')) |
575 | 575 | ||
576 | const bitrate = await getVideoFileBitrate(path) | 576 | const bitrate = await getVideoFileBitrate(path) |
577 | const fps = await getVideoFileFPS(path) | 577 | const fps = await getVideoFileFPS(path) |
@@ -602,21 +602,21 @@ describe('Test video transcoding', function () { | |||
602 | hls: { enabled: true } | 602 | hls: { enabled: true } |
603 | } | 603 | } |
604 | } | 604 | } |
605 | await servers[1].configCommand.updateCustomSubConfig({ newConfig }) | 605 | await servers[1].config.updateCustomSubConfig({ newConfig }) |
606 | 606 | ||
607 | const attributes = { | 607 | const attributes = { |
608 | name: 'low bitrate', | 608 | name: 'low bitrate', |
609 | fixture: 'low-bitrate.mp4' | 609 | fixture: 'low-bitrate.mp4' |
610 | } | 610 | } |
611 | 611 | ||
612 | const { uuid } = await servers[1].videosCommand.upload({ attributes }) | 612 | const { uuid } = await servers[1].videos.upload({ attributes }) |
613 | 613 | ||
614 | await waitJobs(servers) | 614 | await waitJobs(servers) |
615 | 615 | ||
616 | const resolutions = [ 240, 360, 480, 720, 1080 ] | 616 | const resolutions = [ 240, 360, 480, 720, 1080 ] |
617 | for (const r of resolutions) { | 617 | for (const r of resolutions) { |
618 | const path = `videos/${uuid}-${r}.mp4` | 618 | const path = `videos/${uuid}-${r}.mp4` |
619 | const size = await servers[1].serversCommand.getServerFileSize(path) | 619 | const size = await servers[1].servers.getServerFileSize(path) |
620 | expect(size, `${path} not below ${60_000}`).to.be.below(60_000) | 620 | expect(size, `${path} not below ${60_000}`).to.be.below(60_000) |
621 | } | 621 | } |
622 | }) | 622 | }) |
@@ -627,11 +627,11 @@ describe('Test video transcoding', function () { | |||
627 | it('Should provide valid ffprobe data', async function () { | 627 | it('Should provide valid ffprobe data', async function () { |
628 | this.timeout(160_000) | 628 | this.timeout(160_000) |
629 | 629 | ||
630 | const videoUUID = (await servers[1].videosCommand.quickUpload({ name: 'ffprobe data' })).uuid | 630 | const videoUUID = (await servers[1].videos.quickUpload({ name: 'ffprobe data' })).uuid |
631 | await waitJobs(servers) | 631 | await waitJobs(servers) |
632 | 632 | ||
633 | { | 633 | { |
634 | const path = servers[1].serversCommand.buildDirectory(join('videos', videoUUID + '-240.mp4')) | 634 | const path = servers[1].servers.buildDirectory(join('videos', videoUUID + '-240.mp4')) |
635 | const metadata = await getMetadataFromFile(path) | 635 | const metadata = await getMetadataFromFile(path) |
636 | 636 | ||
637 | // expected format properties | 637 | // expected format properties |
@@ -661,7 +661,7 @@ describe('Test video transcoding', function () { | |||
661 | } | 661 | } |
662 | 662 | ||
663 | for (const server of servers) { | 663 | for (const server of servers) { |
664 | const videoDetails = await server.videosCommand.get({ id: videoUUID }) | 664 | const videoDetails = await server.videos.get({ id: videoUUID }) |
665 | 665 | ||
666 | const videoFiles = videoDetails.files | 666 | const videoFiles = videoDetails.files |
667 | .concat(videoDetails.streamingPlaylists[0].files) | 667 | .concat(videoDetails.streamingPlaylists[0].files) |
@@ -673,7 +673,7 @@ describe('Test video transcoding', function () { | |||
673 | expect(file.metadataUrl).to.contain(servers[1].url) | 673 | expect(file.metadataUrl).to.contain(servers[1].url) |
674 | expect(file.metadataUrl).to.contain(videoUUID) | 674 | expect(file.metadataUrl).to.contain(videoUUID) |
675 | 675 | ||
676 | const metadata = await server.videosCommand.getFileMetadata({ url: file.metadataUrl }) | 676 | const metadata = await server.videos.getFileMetadata({ url: file.metadataUrl }) |
677 | expect(metadata).to.have.nested.property('format.size') | 677 | expect(metadata).to.have.nested.property('format.size') |
678 | } | 678 | } |
679 | } | 679 | } |
@@ -690,7 +690,7 @@ describe('Test video transcoding', function () { | |||
690 | describe('Transcoding job queue', function () { | 690 | describe('Transcoding job queue', function () { |
691 | 691 | ||
692 | it('Should have the appropriate priorities for transcoding jobs', async function () { | 692 | it('Should have the appropriate priorities for transcoding jobs', async function () { |
693 | const body = await servers[1].jobsCommand.getJobsList({ | 693 | const body = await servers[1].jobs.getJobsList({ |
694 | start: 0, | 694 | start: 0, |
695 | count: 100, | 695 | count: 100, |
696 | sort: '-createdAt', | 696 | sort: '-createdAt', |