diff options
Diffstat (limited to 'server/types/models/video/video-streaming-playlist.ts')
-rw-r--r-- | server/types/models/video/video-streaming-playlist.ts | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/server/types/models/video/video-streaming-playlist.ts b/server/types/models/video/video-streaming-playlist.ts new file mode 100644 index 000000000..3f54aa560 --- /dev/null +++ b/server/types/models/video/video-streaming-playlist.ts | |||
@@ -0,0 +1,43 @@ | |||
1 | import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist' | ||
2 | import { PickWith, PickWithOpt } from '../../utils' | ||
3 | import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy' | ||
4 | import { MVideo } from './video' | ||
5 | import { MVideoFile } from './video-file' | ||
6 | |||
7 | type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M> | ||
8 | |||
9 | // ############################################################################ | ||
10 | |||
11 | export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'> | ||
12 | |||
13 | export type MStreamingPlaylistFiles = | ||
14 | MStreamingPlaylist & | ||
15 | Use<'VideoFiles', MVideoFile[]> | ||
16 | |||
17 | export type MStreamingPlaylistVideo = | ||
18 | MStreamingPlaylist & | ||
19 | Use<'Video', MVideo> | ||
20 | |||
21 | export type MStreamingPlaylistFilesVideo = | ||
22 | MStreamingPlaylist & | ||
23 | Use<'VideoFiles', MVideoFile[]> & | ||
24 | Use<'Video', MVideo> | ||
25 | |||
26 | export type MStreamingPlaylistRedundanciesAll = | ||
27 | MStreamingPlaylist & | ||
28 | Use<'VideoFiles', MVideoFile[]> & | ||
29 | Use<'RedundancyVideos', MVideoRedundancy[]> | ||
30 | |||
31 | export type MStreamingPlaylistRedundancies = | ||
32 | MStreamingPlaylist & | ||
33 | Use<'VideoFiles', MVideoFile[]> & | ||
34 | Use<'RedundancyVideos', MVideoRedundancyFileUrl[]> | ||
35 | |||
36 | export type MStreamingPlaylistRedundanciesOpt = | ||
37 | MStreamingPlaylist & | ||
38 | Use<'VideoFiles', MVideoFile[]> & | ||
39 | PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]> | ||
40 | |||
41 | export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo { | ||
42 | return !!(value as MStreamingPlaylist).playlistUrl | ||
43 | } | ||