aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2020-11-04 15:31:32 +0100
committerChocobozzz <chocobozzz@cpy.re>2020-11-09 15:33:04 +0100
commitbd54ad1953ee0484ba90cf5f588f4c282048f368 (patch)
tree36e84ed92589a8775bc18e1b056f6b8de14bf2bb /server/models
parent68e70a745b2010cd0199864a2addd60d8f99c732 (diff)
downloadPeerTube-bd54ad1953ee0484ba90cf5f588f4c282048f368.tar.gz
PeerTube-bd54ad1953ee0484ba90cf5f588f4c282048f368.tar.zst
PeerTube-bd54ad1953ee0484ba90cf5f588f4c282048f368.zip
Add live notification tests
Diffstat (limited to 'server/models')
-rw-r--r--server/models/video/video-file.ts4
-rw-r--r--server/models/video/video-format-utils.ts5
2 files changed, 8 insertions, 1 deletions
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<VideoFileModel> {
329 return !!MIMETYPES.AUDIO.EXT_MIMETYPE[this.extname] 329 return !!MIMETYPES.AUDIO.EXT_MIMETYPE[this.extname]
330 } 330 }
331 331
332 isLive () {
333 return this.size === -1
334 }
335
332 hasSameUniqueKeysThan (other: MVideoFile) { 336 hasSameUniqueKeysThan (other: MVideoFile) {
333 return this.fps === other.fps && 337 return this.fps === other.fps &&
334 this.resolution === other.resolution && 338 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 (
199 const video = extractVideo(model) 199 const video = extractVideo(model)
200 200
201 return [ ...videoFiles ] 201 return [ ...videoFiles ]
202 .filter(f => !f.isLive())
202 .sort(sortByResolutionDesc) 203 .sort(sortByResolutionDesc)
203 .map(videoFile => { 204 .map(videoFile => {
204 return { 205 return {
@@ -225,7 +226,9 @@ function addVideoFilesInAPAcc (
225 baseUrlWs: string, 226 baseUrlWs: string,
226 files: MVideoFile[] 227 files: MVideoFile[]
227) { 228) {
228 const sortedFiles = [ ...files ].sort(sortByResolutionDesc) 229 const sortedFiles = [ ...files ]
230 .filter(f => !f.isLive())
231 .sort(sortByResolutionDesc)
229 232
230 for (const file of sortedFiles) { 233 for (const file of sortedFiles) {
231 acc.push({ 234 acc.push({