diff options
Diffstat (limited to 'server/models/video/video.ts')
-rw-r--r-- | server/models/video/video.ts | 30 |
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' |
27 | import { buildNSFWFilter } from '@server/helpers/express-utils' | 27 | import { buildNSFWFilter } from '@server/helpers/express-utils' |
28 | import { getPrivaciesForFederation, isPrivacyForFederation } from '@server/helpers/video' | 28 | import { getPrivaciesForFederation, isPrivacyForFederation } from '@server/helpers/video' |
29 | import { LiveManager } from '@server/lib/live-manager' | ||
29 | import { getHLSDirectory, getTorrentFileName, getTorrentFilePath, getVideoFilename, getVideoFilePath } from '@server/lib/video-paths' | 30 | import { getHLSDirectory, getTorrentFileName, getTorrentFilePath, getVideoFilename, getVideoFilePath } from '@server/lib/video-paths' |
30 | import { getServerActor } from '@server/models/application/application' | 31 | import { getServerActor } from '@server/models/application/application' |
31 | import { ModelCache } from '@server/models/model-cache' | 32 | import { 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' |
123 | import { VideoImportModel } from './video-import' | 124 | import { VideoImportModel } from './video-import' |
125 | import { VideoLiveModel } from './video-live' | ||
124 | import { VideoPlaylistElementModel } from './video-playlist-element' | 126 | import { VideoPlaylistElementModel } from './video-playlist-element' |
125 | import { buildListQuery, BuildVideosQueryOptions, wrapForAPIResults } from './video-query-builder' | 127 | import { buildListQuery, BuildVideosQueryOptions, wrapForAPIResults } from './video-query-builder' |
126 | import { VideoShareModel } from './video-share' | 128 | import { VideoShareModel } from './video-share' |
127 | import { VideoStreamingPlaylistModel } from './video-streaming-playlist' | 129 | import { VideoStreamingPlaylistModel } from './video-streaming-playlist' |
128 | import { VideoTagModel } from './video-tag' | 130 | import { VideoTagModel } from './video-tag' |
129 | import { VideoViewModel } from './video-view' | 131 | import { VideoViewModel } from './video-view' |
130 | import { LiveManager } from '@server/lib/live-manager' | ||
131 | import { VideoLiveModel } from './video-live' | ||
132 | 132 | ||
133 | export enum ScopeNames { | 133 | export 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 | ||
148 | export type ForAPIOptions = { | 149 | export 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 | ] |