]>
Commit | Line | Data |
---|---|---|
6b5f72be | 1 | import { PickWith, PickWithOpt } from '@shared/typescript-utils' |
453e83ea | 2 | import { VideoFileModel } from '../../../models/video/video-file' |
453e83ea | 3 | import { MVideo, MVideoUUID } from './video' |
b764380a | 4 | import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy' |
6b5f72be | 5 | import { MStreamingPlaylist, MStreamingPlaylistVideo } 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 | 12 | |
a1587156 C |
13 | export type MVideoFileVideo = |
14 | MVideoFile & | |
0283eaac | 15 | Use<'Video', MVideo> |
453e83ea | 16 | |
a1587156 C |
17 | export type MVideoFileStreamingPlaylist = |
18 | MVideoFile & | |
d7a25329 C |
19 | Use<'VideoStreamingPlaylist', MStreamingPlaylist> |
20 | ||
a1587156 C |
21 | export type MVideoFileStreamingPlaylistVideo = |
22 | MVideoFile & | |
d7a25329 C |
23 | Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo> |
24 | ||
a1587156 C |
25 | export type MVideoFileVideoUUID = |
26 | MVideoFile & | |
0283eaac | 27 | Use<'Video', MVideoUUID> |
453e83ea | 28 | |
a1587156 C |
29 | export type MVideoFileRedundanciesAll = |
30 | MVideoFile & | |
b764380a C |
31 | PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]> |
32 | ||
a1587156 C |
33 | export type MVideoFileRedundanciesOpt = |
34 | MVideoFile & | |
453e83ea | 35 | PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]> |
d7a25329 C |
36 | |
37 | export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist { | |
38 | return !!file.videoStreamingPlaylistId | |
39 | } | |
40 | ||
41 | export function isWebtorrentFile (file: any): file is MVideoFileVideo { | |
42 | return !!file.videoId | |
43 | } |