Refactor enableTranscoding command helpers

pull/5914/merge
Chocobozzz 2023-07-28 16:06:49 +02:00
parent e390107e5a
commit 74c8d5bf2d
No known key found for this signature in database
GPG Key ID: 583A612D890159BE
14 changed files with 43 additions and 34 deletions

View File

@ -65,7 +65,7 @@ describe('Test managing runners', function () {
registrationToken = data[0].registrationToken
registrationTokenId = data[0].id
await server.config.enableTranscoding(true, true)
await server.config.enableTranscoding({ hls: true, webVideo: true })
await server.config.enableStudio()
await server.config.enableRemoteTranscoding()
await server.config.enableRemoteStudio()
@ -451,7 +451,7 @@ describe('Test managing runners', function () {
const { uuid } = await server.videos.quickUpload({ name: 'video studio' })
videoStudioUUID = uuid
await server.config.enableTranscoding(true, true)
await server.config.enableTranscoding({ hls: true, webVideo: true })
await server.config.enableStudio()
await server.videoStudio.createEditionTasks({

View File

@ -87,7 +87,7 @@ describe('Test videos files', function () {
}
{
await servers[0].config.enableTranscoding(true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true })
{
const { uuid } = await servers[0].videos.quickUpload({ name: 'both 1' })
@ -108,7 +108,7 @@ describe('Test videos files', function () {
await waitJobs(servers)
{
await servers[0].config.enableTranscoding(false, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: false })
const { uuid } = await servers[0].videos.quickUpload({ name: 'hls' })
hlsId = uuid
}
@ -116,7 +116,7 @@ describe('Test videos files', function () {
await waitJobs(servers)
{
await servers[0].config.enableTranscoding(false, true)
await servers[0].config.enableTranscoding({ webVideo: true, hls: false })
const { uuid } = await servers[0].videos.quickUpload({ name: 'web-video' })
webVideoId = uuid
}

View File

@ -133,7 +133,7 @@ describe('Fast restream in live', function () {
await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ])
await server.config.enableMinimumTranscoding(false, true)
await server.config.enableMinimumTranscoding({ webVideo: false, hls: true })
await server.config.enableLive({ allowReplay: true, transcoding: true, resolutions: 'min' })
})

View File

@ -40,7 +40,7 @@ describe('Test runner common actions', function () {
await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ])
await server.config.enableTranscoding(true, true)
await server.config.enableTranscoding({ hls: true, webVideo: true })
await server.config.enableRemoteTranscoding()
})

View File

@ -23,7 +23,7 @@ describe('Test runner socket', function () {
await setAccessTokensToServers([ server ])
await setDefaultVideoChannel([ server ])
await server.config.enableTranscoding(true, true)
await server.config.enableTranscoding({ hls: true, webVideo: true })
await server.config.enableRemoteTranscoding()
runnerToken = await server.runners.autoRegisterRunner()
})

View File

@ -53,7 +53,7 @@ describe('Test runner video studio transcoding', function () {
await doubleFollow(servers[0], servers[1])
await servers[0].config.enableTranscoding(true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true })
await servers[0].config.enableStudio()
await servers[0].config.enableRemoteStudio()

View File

@ -85,7 +85,7 @@ describe('Test runner VOD transcoding', function () {
before(async function () {
this.timeout(60000)
await servers[0].config.enableTranscoding(true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true })
})
it('Should error a transcoding job', async function () {
@ -133,7 +133,7 @@ describe('Test runner VOD transcoding', function () {
this.timeout(60000)
await servers[0].runnerJobs.cancelAllJobs()
await servers[0].config.enableTranscoding(true, false)
await servers[0].config.enableTranscoding({ hls: false, webVideo: true })
const { uuid } = await servers[0].videos.quickUpload({ name: 'web video', fixture: 'video_short.webm' })
videoUUID = uuid
@ -264,7 +264,7 @@ describe('Test runner VOD transcoding', function () {
before(async function () {
this.timeout(60000)
await servers[0].config.enableTranscoding(false, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: false })
const { uuid } = await servers[0].videos.quickUpload({ name: 'hls video', fixture: 'video_short.webm' })
videoUUID = uuid
@ -384,7 +384,7 @@ describe('Test runner VOD transcoding', function () {
before(async function () {
this.timeout(60000)
await servers[0].config.enableTranscoding(true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true })
await servers[0].videos.quickUpload({ name: 'web video and hls video', fixture: 'video_short.webm' })
@ -422,7 +422,7 @@ describe('Test runner VOD transcoding', function () {
before(async function () {
this.timeout(60000)
await servers[0].config.enableTranscoding(true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true })
const attributes = { name: 'audio_with_preview', previewfile: 'custom-preview.jpg', fixture: 'sample.ogg' }
const { uuid } = await servers[0].videos.upload({ attributes, mode: 'legacy' })

View File

@ -25,7 +25,7 @@ describe('Test videos files', function () {
await doubleFollow(servers[0], servers[1])
await servers[0].config.enableTranscoding(true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true })
})
describe('When deleting all files', function () {

View File

@ -114,7 +114,7 @@ describe('Test a video file replacement', function () {
const previousPaths: string[] = []
await servers[0].config.enableTranscoding(true, true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true, with0p: true })
const { uuid: videoUUID } = await servers[0].videos.quickUpload({ name: 'fs with transcoding', fixture: 'video_short_720p.mp4' })
uuid = videoUUID
@ -387,7 +387,7 @@ describe('Test a video file replacement', function () {
const previousPaths: string[] = []
await servers[0].config.enableTranscoding(true, true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true, with0p: true })
const { uuid: videoUUID } = await servers[0].videos.quickUpload({
name: 'object storage with transcoding',

View File

@ -468,19 +468,19 @@ describe('Test videos filter', function () {
const finderFactory = (name: string) => (videos: Video[]) => videos.some(v => v.name === name)
await servers[0].config.enableTranscoding(true, false)
await servers[0].config.enableTranscoding({ hls: false, webVideo: true })
await servers[0].videos.upload({ attributes: { name: 'web video' } })
const hasWebVideo = finderFactory('web video')
await waitJobs(servers)
await servers[0].config.enableTranscoding(false, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: false })
await servers[0].videos.upload({ attributes: { name: 'hls video' } })
const hasHLS = finderFactory('hls video')
await waitJobs(servers)
await servers[0].config.enableTranscoding(true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true })
await servers[0].videos.upload({ attributes: { name: 'hls and web video' } })
const hasBoth = finderFactory('hls and web video')

View File

@ -139,7 +139,7 @@ describe('Test Live transcoding in peertube-runner program', function () {
sqlCommandServer1 = new SQLCommand(servers[0])
await servers[0].config.enableRemoteTranscoding()
await servers[0].config.enableTranscoding(true, true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true, with0p: true })
await servers[0].config.enableLive({ allowReplay: true, resolutions: 'max', transcoding: true })
const registrationToken = await servers[0].runnerRegistrationTokens.getFirstRegistrationToken()
@ -152,7 +152,7 @@ describe('Test Live transcoding in peertube-runner program', function () {
describe('With lives on local filesystem storage', function () {
before(async function () {
await servers[0].config.enableTranscoding(true, false, true)
await servers[0].config.enableTranscoding({ webVideo: true, hls: false, with0p: true })
})
runSuite()

View File

@ -68,7 +68,7 @@ describe('Test studio transcoding in peertube-runner program', function () {
await doubleFollow(servers[0], servers[1])
await servers[0].config.enableTranscoding(true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true })
await servers[0].config.enableStudio()
await servers[0].config.enableRemoteStudio()

View File

@ -201,7 +201,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
expect(getAllFiles(video)).to.have.lengthOf(1)
}
await servers[0].config.enableTranscoding(true, true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true, with0p: true })
await servers[0].videos.runTranscoding({ transcodingType: 'web-video', videoId: uuid })
await waitJobs(servers, { runnerJobs: true })
@ -259,7 +259,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
describe('Web video only enabled', function () {
before(async function () {
await servers[0].config.enableTranscoding(true, false, true)
await servers[0].config.enableTranscoding({ webVideo: true, hls: false, with0p: true })
})
runSuite({ webVideoEnabled: true, hlsEnabled: false })
@ -268,7 +268,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
describe('HLS videos only enabled', function () {
before(async function () {
await servers[0].config.enableTranscoding(false, true, true)
await servers[0].config.enableTranscoding({ webVideo: false, hls: true, with0p: true })
})
runSuite({ webVideoEnabled: false, hlsEnabled: true })
@ -277,7 +277,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
describe('Web video & HLS enabled', function () {
before(async function () {
await servers[0].config.enableTranscoding(true, true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true, with0p: true })
})
runSuite({ webVideoEnabled: true, hlsEnabled: true })
@ -303,7 +303,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
describe('Web video only enabled', function () {
before(async function () {
await servers[0].config.enableTranscoding(true, false, true)
await servers[0].config.enableTranscoding({ webVideo: true, hls: false, with0p: true })
})
runSuite({ webVideoEnabled: true, hlsEnabled: false, objectStorage })
@ -312,7 +312,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
describe('HLS videos only enabled', function () {
before(async function () {
await servers[0].config.enableTranscoding(false, true, true)
await servers[0].config.enableTranscoding({ webVideo: false, hls: true, with0p: true })
})
runSuite({ webVideoEnabled: false, hlsEnabled: true, objectStorage })
@ -321,7 +321,7 @@ describe('Test VOD transcoding in peertube-runner program', function () {
describe('Web video & HLS enabled', function () {
before(async function () {
await servers[0].config.enableTranscoding(true, true, true)
await servers[0].config.enableTranscoding({ hls: true, webVideo: true, with0p: true })
})
runSuite({ webVideoEnabled: true, hlsEnabled: true, objectStorage })

View File

@ -152,8 +152,13 @@ export class ConfigCommand extends AbstractCommand {
})
}
// TODO: convert args to object
enableTranscoding (webVideo = true, hls = true, with0p = false) {
enableTranscoding (options: {
webVideo?: boolean // default true
hls?: boolean // default true
with0p?: boolean // default false
} = {}) {
const { webVideo = true, hls = true, with0p = false } = options
return this.updateExistingSubConfig({
newConfig: {
transcoding: {
@ -175,8 +180,12 @@ export class ConfigCommand extends AbstractCommand {
})
}
// TODO: convert args to object
enableMinimumTranscoding (webVideo = true, hls = true) {
enableMinimumTranscoding (options: {
webVideo?: boolean // default true
hls?: boolean // default true
} = {}) {
const { webVideo = true, hls = true } = options
return this.updateExistingSubConfig({
newConfig: {
transcoding: {