aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models
diff options
context:
space:
mode:
Diffstat (limited to 'server/models')
-rw-r--r--server/models/redundancy/video-redundancy.ts44
-rw-r--r--server/models/video/video.ts1
2 files changed, 1 insertions, 44 deletions
diff --git a/server/models/redundancy/video-redundancy.ts b/server/models/redundancy/video-redundancy.ts
index ef780c2a4..f7a989691 100644
--- a/server/models/redundancy/video-redundancy.ts
+++ b/server/models/redundancy/video-redundancy.ts
@@ -408,50 +408,6 @@ export class VideoRedundancyModel extends Model<Partial<AttributesOnly<VideoRedu
408 return VideoRedundancyModel.scope([ ScopeNames.WITH_VIDEO ]).findOne(query) 408 return VideoRedundancyModel.scope([ ScopeNames.WITH_VIDEO ]).findOne(query)
409 } 409 }
410 410
411 static async getTotalDuplicated (strategy: VideoRedundancyStrategy) {
412 const actor = await getServerActor()
413 const redundancyInclude = {
414 attributes: [],
415 model: VideoRedundancyModel,
416 required: true,
417 where: {
418 actorId: actor.id,
419 strategy
420 }
421 }
422
423 const queryFiles: FindOptions = {
424 include: [ redundancyInclude ]
425 }
426
427 const queryStreamingPlaylists: FindOptions = {
428 include: [
429 {
430 attributes: [],
431 model: VideoModel.unscoped(),
432 required: true,
433 include: [
434 {
435 required: true,
436 attributes: [],
437 model: VideoStreamingPlaylistModel.unscoped(),
438 include: [
439 redundancyInclude
440 ]
441 }
442 ]
443 }
444 ]
445 }
446
447 return Promise.all([
448 VideoFileModel.aggregate('size', 'SUM', queryFiles),
449 VideoFileModel.aggregate('size', 'SUM', queryStreamingPlaylists)
450 ]).then(([ r1, r2 ]) => {
451 return parseAggregateResult(r1) + parseAggregateResult(r2)
452 })
453 }
454
455 static async listLocalExpired () { 411 static async listLocalExpired () {
456 const actor = await getServerActor() 412 const actor = await getServerActor()
457 413
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index 749ef7197..d4a258187 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -1009,6 +1009,7 @@ export class VideoModel extends Model<Partial<AttributesOnly<VideoModel>>> {
1009 attributes: [ 'id' ], 1009 attributes: [ 'id' ],
1010 where: { 1010 where: {
1011 isLive: true, 1011 isLive: true,
1012 remote: false,
1012 state: VideoState.PUBLISHED 1013 state: VideoState.PUBLISHED
1013 } 1014 }
1014 } 1015 }