+
+ for (const server of servers) {
+ const videoDetails = await server.videos.get({ id: videoUUID })
+
+ const videoFiles = videoDetails.files
+ .concat(videoDetails.streamingPlaylists[0].files)
+ expect(videoFiles).to.have.lengthOf(8)
+
+ for (const file of videoFiles) {
+ expect(file.metadata).to.be.undefined
+ expect(file.metadataUrl).to.exist
+ expect(file.metadataUrl).to.contain(servers[1].url)
+ expect(file.metadataUrl).to.contain(videoUUID)
+
+ const metadata = await server.videos.getFileMetadata({ url: file.metadataUrl })
+ expect(metadata).to.have.nested.property('format.size')
+ }
+ }
+ })
+
+ it('Should correctly detect if quick transcode is possible', async function () {
+ this.timeout(10_000)
+
+ expect(await canDoQuickTranscode(buildAbsoluteFixturePath('video_short.mp4'))).to.be.true
+ expect(await canDoQuickTranscode(buildAbsoluteFixturePath('video_short.webm'))).to.be.false
+ })
+ })
+
+ describe('Transcoding job queue', function () {
+
+ it('Should have the appropriate priorities for transcoding jobs', async function () {
+ const body = await servers[1].jobs.list({
+ start: 0,
+ count: 100,
+ sort: '-createdAt',
+ jobType: 'video-transcoding'
+ })
+
+ const jobs = body.data
+ const transcodingJobs = jobs.filter(j => j.data.videoUUID === video4k)
+
+ expect(transcodingJobs).to.have.lengthOf(14)
+
+ const hlsJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-hls')
+ const webtorrentJobs = transcodingJobs.filter(j => j.data.type === 'new-resolution-to-webtorrent')
+ const optimizeJobs = transcodingJobs.filter(j => j.data.type === 'optimize-to-webtorrent')
+
+ expect(hlsJobs).to.have.lengthOf(7)
+ expect(webtorrentJobs).to.have.lengthOf(6)
+ expect(optimizeJobs).to.have.lengthOf(1)
+
+ for (const j of optimizeJobs.concat(hlsJobs.concat(webtorrentJobs))) {
+ expect(j.priority).to.be.greaterThan(100)
+ expect(j.priority).to.be.lessThan(150)
+ }
+ })