]>
Commit | Line | Data |
---|---|---|
453e83ea C |
1 | import { VideoFileModel } from '../../../models/video/video-file' |
2 | import { PickWith, PickWithOpt } from '../../utils' | |
3 | import { MVideo, MVideoUUID } from './video' | |
b764380a | 4 | import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy' |
d7a25329 | 5 | import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist' |
453e83ea | 6 | |
0283eaac C |
7 | type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M> |
8 | ||
9 | // ############################################################################ | |
10 | ||
d7a25329 | 11 | export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos' | 'VideoStreamingPlaylist'> |
453e83ea C |
12 | |
13 | export type MVideoFileVideo = MVideoFile & | |
0283eaac | 14 | Use<'Video', MVideo> |
453e83ea | 15 | |
d7a25329 C |
16 | export type MVideoFileStreamingPlaylist = MVideoFile & |
17 | Use<'VideoStreamingPlaylist', MStreamingPlaylist> | |
18 | ||
19 | export type MVideoFileStreamingPlaylistVideo = MVideoFile & | |
20 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> | |
21 | ||
453e83ea | 22 | export type MVideoFileVideoUUID = MVideoFile & |
0283eaac | 23 | Use<'Video', MVideoUUID> |
453e83ea | 24 | |
b764380a C |
25 | export type MVideoFileRedundanciesAll = MVideoFile & |
26 | PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]> | |
27 | ||
453e83ea C |
28 | export type MVideoFileRedundanciesOpt = MVideoFile & |
29 | PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]> | |
d7a25329 C |
30 | |
31 | export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist { | |
32 | return !!file.videoStreamingPlaylistId | |
33 | } | |
34 | ||
35 | export function isWebtorrentFile (file: any): file is MVideoFileVideo { | |
36 | return !!file.videoId | |
37 | } |