aboutsummaryrefslogtreecommitdiffhomepage
path: root/server/models/video/video.ts
diff options
context:
space:
mode:
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r--server/models/video/video.ts30
1 files changed, 26 insertions, 4 deletions
diff --git a/server/models/video/video.ts b/server/models/video/video.ts
index d094f19b0..aba8c8cf4 100644
--- a/server/models/video/video.ts
+++ b/server/models/video/video.ts
@@ -26,6 +26,7 @@ import {
26} from 'sequelize-typescript' 26} from 'sequelize-typescript'
27import { buildNSFWFilter } from '@server/helpers/express-utils' 27import { buildNSFWFilter } from '@server/helpers/express-utils'
28import { getPrivaciesForFederation, isPrivacyForFederation } from '@server/helpers/video' 28import { getPrivaciesForFederation, isPrivacyForFederation } from '@server/helpers/video'
29import { LiveManager } from '@server/lib/live-manager'
29import { getHLSDirectory, getTorrentFileName, getTorrentFilePath, getVideoFilename, getVideoFilePath } from '@server/lib/video-paths' 30import { getHLSDirectory, getTorrentFileName, getTorrentFilePath, getVideoFilename, getVideoFilePath } from '@server/lib/video-paths'
30import { getServerActor } from '@server/models/application/application' 31import { getServerActor } from '@server/models/application/application'
31import { ModelCache } from '@server/models/model-cache' 32import { ModelCache } from '@server/models/model-cache'
@@ -121,14 +122,13 @@ import {
121 videoModelToFormattedJSON 122 videoModelToFormattedJSON
122} from './video-format-utils' 123} from './video-format-utils'
123import { VideoImportModel } from './video-import' 124import { VideoImportModel } from './video-import'
125import { VideoLiveModel } from './video-live'
124import { VideoPlaylistElementModel } from './video-playlist-element' 126import { VideoPlaylistElementModel } from './video-playlist-element'
125import { buildListQuery, BuildVideosQueryOptions, wrapForAPIResults } from './video-query-builder' 127import { buildListQuery, BuildVideosQueryOptions, wrapForAPIResults } from './video-query-builder'
126import { VideoShareModel } from './video-share' 128import { VideoShareModel } from './video-share'
127import { VideoStreamingPlaylistModel } from './video-streaming-playlist' 129import { VideoStreamingPlaylistModel } from './video-streaming-playlist'
128import { VideoTagModel } from './video-tag' 130import { VideoTagModel } from './video-tag'
129import { VideoViewModel } from './video-view' 131import { VideoViewModel } from './video-view'
130import { LiveManager } from '@server/lib/live-manager'
131import { VideoLiveModel } from './video-live'
132 132
133export enum ScopeNames { 133export enum ScopeNames {
134 AVAILABLE_FOR_LIST_IDS = 'AVAILABLE_FOR_LIST_IDS', 134 AVAILABLE_FOR_LIST_IDS = 'AVAILABLE_FOR_LIST_IDS',
@@ -142,7 +142,8 @@ export enum ScopeNames {
142 WITH_STREAMING_PLAYLISTS = 'WITH_STREAMING_PLAYLISTS', 142 WITH_STREAMING_PLAYLISTS = 'WITH_STREAMING_PLAYLISTS',
143 WITH_USER_ID = 'WITH_USER_ID', 143 WITH_USER_ID = 'WITH_USER_ID',
144 WITH_IMMUTABLE_ATTRIBUTES = 'WITH_IMMUTABLE_ATTRIBUTES', 144 WITH_IMMUTABLE_ATTRIBUTES = 'WITH_IMMUTABLE_ATTRIBUTES',
145 WITH_THUMBNAILS = 'WITH_THUMBNAILS' 145 WITH_THUMBNAILS = 'WITH_THUMBNAILS',
146 WITH_LIVE = 'WITH_LIVE'
146} 147}
147 148
148export type ForAPIOptions = { 149export type ForAPIOptions = {
@@ -245,6 +246,14 @@ export type AvailableForListIDsOptions = {
245 } 246 }
246 ] 247 ]
247 }, 248 },
249 [ScopeNames.WITH_LIVE]: {
250 include: [
251 {
252 model: VideoLiveModel,
253 required: false
254 }
255 ]
256 },
248 [ScopeNames.WITH_USER_ID]: { 257 [ScopeNames.WITH_USER_ID]: {
249 include: [ 258 include: [
250 { 259 {
@@ -943,6 +952,17 @@ export class VideoModel extends Model<VideoModel> {
943 } 952 }
944 ] 953 ]
945 }, 954 },
955 {
956 model: VideoStreamingPlaylistModel.unscoped(),
957 required: false,
958 include: [
959 {
960 model: VideoFileModel,
961 required: false
962 }
963 ]
964 },
965 VideoLiveModel,
946 VideoFileModel, 966 VideoFileModel,
947 TagModel 967 TagModel
948 ] 968 ]
@@ -1330,7 +1350,8 @@ export class VideoModel extends Model<VideoModel> {
1330 ScopeNames.WITH_SCHEDULED_UPDATE, 1350 ScopeNames.WITH_SCHEDULED_UPDATE,
1331 ScopeNames.WITH_WEBTORRENT_FILES, 1351 ScopeNames.WITH_WEBTORRENT_FILES,
1332 ScopeNames.WITH_STREAMING_PLAYLISTS, 1352 ScopeNames.WITH_STREAMING_PLAYLISTS,
1333 ScopeNames.WITH_THUMBNAILS 1353 ScopeNames.WITH_THUMBNAILS,
1354 ScopeNames.WITH_LIVE
1334 ] 1355 ]
1335 1356
1336 if (userId) { 1357 if (userId) {
@@ -1362,6 +1383,7 @@ export class VideoModel extends Model<VideoModel> {
1362 ScopeNames.WITH_ACCOUNT_DETAILS, 1383 ScopeNames.WITH_ACCOUNT_DETAILS,
1363 ScopeNames.WITH_SCHEDULED_UPDATE, 1384 ScopeNames.WITH_SCHEDULED_UPDATE,
1364 ScopeNames.WITH_THUMBNAILS, 1385 ScopeNames.WITH_THUMBNAILS,
1386 ScopeNames.WITH_LIVE,
1365 { method: [ ScopeNames.WITH_WEBTORRENT_FILES, true ] }, 1387 { method: [ ScopeNames.WITH_WEBTORRENT_FILES, true ] },
1366 { method: [ ScopeNames.WITH_STREAMING_PLAYLISTS, true ] } 1388 { method: [ ScopeNames.WITH_STREAMING_PLAYLISTS, true ] }
1367 ] 1389 ]