]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/commitdiff
Include video file id in API
authorChocobozzz <me@florianbigard.com>
Fri, 29 Jul 2022 09:32:46 +0000 (11:32 +0200)
committerChocobozzz <me@florianbigard.com>
Fri, 29 Jul 2022 09:33:27 +0000 (11:33 +0200)
server/models/video/formatter/video-format-utils.ts
server/tests/shared/videos.ts
shared/models/videos/file/video-file.model.ts
support/doc/api/openapi.yaml

index fd02f8c6415f5958ae7cef28431709bde185e32d..e1b0eb6108e00d8a131044d92a502ba0fccf65a2 100644 (file)
@@ -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`
index 989865a4906f74887f2b411240e1caeeac9205c9..3ab2453920f9a2df3d7b268576eb47fe7f980bed 100644 (file)
@@ -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`))
index 0ea857e7ac0d00882abaae8c2c6d540bbaa10967..2bbff48eb6b1b8ea89774116f1e8676f9be29dc8 100644 (file)
@@ -3,6 +3,8 @@ import { VideoFileMetadata } from './video-file-metadata.model'
 import { VideoResolution } from './video-resolution.enum'
 
 export interface VideoFile {
+  id: number
+
   resolution: VideoConstant<VideoResolution>
   size: number // Bytes
 
index 9745f68e98d104471e022a394fcb38d8a5b78138..3092a99609144f52219c153f6361ab89c5c2d6f3 100644 (file)
@@ -5665,6 +5665,8 @@ components:
     VideoFile:
       readOnly: true
       properties:
+        id:
+          $ref: '#/components/schemas/id'
         magnetUri:
           type: string
           format: uri