From bd54ad1953ee0484ba90cf5f588f4c282048f368 Mon Sep 17 00:00:00 2001 From: Chocobozzz Date: Wed, 4 Nov 2020 15:31:32 +0100 Subject: Add live notification tests --- server/models/video/video-file.ts | 4 ++++ server/models/video/video-format-utils.ts | 5 ++++- 2 files changed, 8 insertions(+), 1 deletion(-) (limited to 'server/models') diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts index 8c8fc0b51..5048cf9b7 100644 --- a/server/models/video/video-file.ts +++ b/server/models/video/video-file.ts @@ -329,6 +329,10 @@ export class VideoFileModel extends Model { return !!MIMETYPES.AUDIO.EXT_MIMETYPE[this.extname] } + isLive () { + return this.size === -1 + } + hasSameUniqueKeysThan (other: MVideoFile) { return this.fps === other.fps && this.resolution === other.resolution && diff --git a/server/models/video/video-format-utils.ts b/server/models/video/video-format-utils.ts index 04e636a15..d4b213686 100644 --- a/server/models/video/video-format-utils.ts +++ b/server/models/video/video-format-utils.ts @@ -199,6 +199,7 @@ function videoFilesModelToFormattedJSON ( const video = extractVideo(model) return [ ...videoFiles ] + .filter(f => !f.isLive()) .sort(sortByResolutionDesc) .map(videoFile => { return { @@ -225,7 +226,9 @@ function addVideoFilesInAPAcc ( baseUrlWs: string, files: MVideoFile[] ) { - const sortedFiles = [ ...files ].sort(sortByResolutionDesc) + const sortedFiles = [ ...files ] + .filter(f => !f.isLive()) + .sort(sortByResolutionDesc) for (const file of sortedFiles) { acc.push({ -- cgit v1.2.3