From 12d84abeca4917d2f1e3f308010bfcd56d37cb7c Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Fri, 29 Jul 2022 11:32:46 +0200 Subject: Include video file id in API --- server/models/video/formatter/video-format-utils.ts | 2 ++ server/tests/shared/videos.ts | 1 + 2 files changed, 3 insertions(+) (limited to 'server') diff --git a/server/models/video/formatter/video-format-utils.ts b/server/models/video/formatter/video-format-utils.ts index fd02f8c64..e1b0eb610 100644 --- a/server/models/video/formatter/video-format-utils.ts +++ b/server/models/video/formatter/video-format-utils.ts @@ -256,6 +256,8 @@ function videoFilesModelToFormattedJSON ( .sort(sortByResolutionDesc) .map(videoFile => { return { + id: videoFile.id, + resolution: { id: videoFile.resolution, label: videoFile.resolution === 0 ? 'Audio' : `${videoFile.resolution}p` diff --git a/server/tests/shared/videos.ts b/server/tests/shared/videos.ts index 989865a49..3ab245392 100644 --- a/server/tests/shared/videos.ts +++ b/server/tests/shared/videos.ts @@ -115,6 +115,7 @@ async function completeVideoCheck ( // Transcoding enabled: extension will always be .mp4 if (attributes.files.length > 1) extension = '.mp4' + expect(file.id).to.exist expect(file.magnetUri).to.have.lengthOf.above(2) expect(file.torrentDownloadUrl).to.match(new RegExp(`http://${host}/download/torrents/${uuidRegex}-${file.resolution.id}.torrent`)) -- cgit v1.2.3