aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video-file.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video-file.ts')
-rw-r--r--server/models/video/video-file.ts24
1 files changed, 24 insertions, 0 deletions
diff --git a/server/models/video/video-file.ts b/server/models/video/video-file.ts
index b861b0704..c14d96bc5 100644
--- a/server/models/video/video-file.ts
+++ b/server/models/video/video-file.ts
@@ -23,6 +23,7 @@ import { throwIfNotValid } from '../utils'
23import { VideoModel } from './video' 23import { VideoModel } from './video'
24import * as Sequelize from 'sequelize' 24import * as Sequelize from 'sequelize'
25import { VideoRedundancyModel } from '../redundancy/video-redundancy' 25import { VideoRedundancyModel } from '../redundancy/video-redundancy'
26import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
26 27
27@Table({ 28@Table({
28 tableName: 'videoFile', 29 tableName: 'videoFile',
@@ -120,6 +121,29 @@ export class VideoFileModel extends Model<VideoFileModel> {
120 return VideoFileModel.findByPk(id, options) 121 return VideoFileModel.findByPk(id, options)
121 } 122 }
122 123
124 static listByStreamingPlaylist (streamingPlaylistId: number, transaction: Sequelize.Transaction) {
125 const query = {
126 include: [
127 {
128 model: VideoModel.unscoped(),
129 required: true,
130 include: [
131 {
132 model: VideoStreamingPlaylistModel.unscoped(),
133 required: true,
134 where: {
135 id: streamingPlaylistId
136 }
137 }
138 ]
139 }
140 ],
141 transaction
142 }
143
144 return VideoFileModel.findAll(query)
145 }
146
123 static async getStats () { 147 static async getStats () {
124 let totalLocalVideoFilesSize = await VideoFileModel.sum('size', { 148 let totalLocalVideoFilesSize = await VideoFileModel.sum('size', {
125 include: [ 149 include: [