]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - shared/extra-utils/videos/videos-command.ts
Optimize torrent URL update
[github/Chocobozzz/PeerTube.git] / shared / extra-utils / videos / videos-command.ts
index 98465e8f69f9d7741709ab16c5c7f04938ff2bdb..d35339c8d4770b3e57b3041da73967df3420b7c6 100644 (file)
@@ -3,10 +3,11 @@
 import { expect } from 'chai'
 import { createReadStream, stat } from 'fs-extra'
 import got, { Response as GotResponse } from 'got'
-import { omit, pick } from 'lodash'
+import { omit } from 'lodash'
 import validator from 'validator'
 import { buildUUID } from '@server/helpers/uuid'
 import { loadLanguages } from '@server/initializers/constants'
+import { pick } from '@shared/core-utils'
 import {
   HttpStatusCode,
   ResultList,
@@ -187,6 +188,17 @@ export class VideosCommand extends AbstractCommand {
     return id
   }
 
+  async listFiles (options: OverrideCommandOptions & {
+    id: number | string
+  }) {
+    const video = await this.get(options)
+
+    const files = video.files || []
+    const hlsFiles = video.streamingPlaylists[0]?.files || []
+
+    return files.concat(hlsFiles)
+  }
+
   // ---------------------------------------------------------------------------
 
   listMyVideos (options: OverrideCommandOptions & {