From 9b293cd6a2ce9ed1e1ccd41adbf7f2dbe2da8231 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 8 Dec 2021 11:07:19 +0100 Subject: Update torrent metadata on video update --- server/models/video/video.ts | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'server/models/video/video.ts') diff --git a/server/models/video/video.ts b/server/models/video/video.ts index 1050463d2..801e23f55 100644 --- a/server/models/video/video.ts +++ b/server/models/video/video.ts @@ -1539,6 +1539,21 @@ export class VideoModel extends Model>> { return this.VideoChannel.Account.Actor.Server?.isBlocked() || this.VideoChannel.Account.isBlocked() } + getAllFiles () { + let files: MVideoFile[] = [] + + if (Array.isArray(this.VideoFiles)) { + files = files.concat(this.VideoFiles) + } + + const hls = this.getHLSPlaylist() + if (hls) { + files = files.concat(hls.VideoFiles) + } + + return files + } + getQualityFileBy (this: T, fun: (files: MVideoFile[], it: (file: MVideoFile) => number) => MVideoFile) { // We first transcode to WebTorrent format, so try this array first if (Array.isArray(this.VideoFiles) && this.VideoFiles.length !== 0) { -- cgit v1.2.3