From 4434e78c567f6d7436a56c4ec7deec63605f78ec Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 28 Feb 2024 10:00:01 +0100 Subject: [PATCH] Fix tests --- packages/tests/src/shared/streaming-playlists.ts | 9 +++++++-- packages/tests/src/shared/videos.ts | 9 +++++++-- server/core/lib/video-file.ts | 3 +++ 3 files changed, 17 insertions(+), 4 deletions(-) diff --git a/packages/tests/src/shared/streaming-playlists.ts b/packages/tests/src/shared/streaming-playlists.ts index 8a601266f..b187ba47c 100644 --- a/packages/tests/src/shared/streaming-playlists.ts +++ b/packages/tests/src/shared/streaming-playlists.ts @@ -145,8 +145,13 @@ async function completeCheckHlsPlaylist (options: { expect(file.resolution.label).to.equal(resolution + 'p') } - expect(Math.min(file.height, file.width)).to.equal(resolution) - expect(Math.max(file.height, file.width)).to.be.greaterThan(resolution) + if (resolution === 0) { + expect(file.height).to.equal(0) + expect(file.width).to.equal(0) + } else { + expect(Math.min(file.height, file.width)).to.equal(resolution) + expect(Math.max(file.height, file.width)).to.be.greaterThan(resolution) + } expect(file.magnetUri).to.have.lengthOf.above(2) await checkWebTorrentWorks(file.magnetUri) diff --git a/packages/tests/src/shared/videos.ts b/packages/tests/src/shared/videos.ts index ede4ecc6c..3ad5852e6 100644 --- a/packages/tests/src/shared/videos.ts +++ b/packages/tests/src/shared/videos.ts @@ -104,8 +104,13 @@ export async function completeWebVideoFilesCheck (options: { if (attributeFile.width !== undefined) expect(file.width).to.equal(attributeFile.width) if (attributeFile.height !== undefined) expect(file.height).to.equal(attributeFile.height) - expect(Math.min(file.height, file.width)).to.equal(file.resolution.id) - expect(Math.max(file.height, file.width)).to.be.greaterThan(file.resolution.id) + if (file.resolution.id === VideoResolution.H_NOVIDEO) { + expect(file.height).to.equal(0) + expect(file.width).to.equal(0) + } else { + expect(Math.min(file.height, file.width)).to.equal(file.resolution.id) + expect(Math.max(file.height, file.width)).to.be.greaterThan(file.resolution.id) + } if (attributeFile.size) { const minSize = attributeFile.size - ((10 * attributeFile.size) / 100) diff --git a/server/core/lib/video-file.ts b/server/core/lib/video-file.ts index f5463363e..70194aa93 100644 --- a/server/core/lib/video-file.ts +++ b/server/core/lib/video-file.ts @@ -27,7 +27,10 @@ async function buildNewFile (options: { }) if (await isAudioFile(path, probe)) { + videoFile.fps = 0 videoFile.resolution = VideoResolution.H_NOVIDEO + videoFile.width = 0 + videoFile.height = 0 } else { const dimensions = await getVideoStreamDimensionsInfo(path, probe) videoFile.fps = await getVideoStreamFPS(path, probe)