2019-08-15 11:53:26 +02:00
|
|
|
import { VideoFileModel } from '../../../models/video/video-file'
|
|
|
|
import { PickWith, PickWithOpt } from '../../utils'
|
|
|
|
import { MVideo, MVideoUUID } from './video'
|
2020-01-10 10:11:28 +01:00
|
|
|
import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'
|
2019-11-15 15:06:03 +01:00
|
|
|
import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist'
|
2019-08-15 11:53:26 +02:00
|
|
|
|
2019-08-20 13:52:49 +02:00
|
|
|
type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>
|
|
|
|
|
|
|
|
// ############################################################################
|
|
|
|
|
2019-11-15 15:06:03 +01:00
|
|
|
export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos' | 'VideoStreamingPlaylist'>
|
2019-08-15 11:53:26 +02:00
|
|
|
|
2020-01-31 16:56:52 +01:00
|
|
|
export type MVideoFileVideo =
|
|
|
|
MVideoFile &
|
2019-08-20 13:52:49 +02:00
|
|
|
Use<'Video', MVideo>
|
2019-08-15 11:53:26 +02:00
|
|
|
|
2020-01-31 16:56:52 +01:00
|
|
|
export type MVideoFileStreamingPlaylist =
|
|
|
|
MVideoFile &
|
2019-11-15 15:06:03 +01:00
|
|
|
Use<'VideoStreamingPlaylist', MStreamingPlaylist>
|
|
|
|
|
2020-01-31 16:56:52 +01:00
|
|
|
export type MVideoFileStreamingPlaylistVideo =
|
|
|
|
MVideoFile &
|
2019-11-15 15:06:03 +01:00
|
|
|
Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
|
|
|
|
|
2020-01-31 16:56:52 +01:00
|
|
|
export type MVideoFileVideoUUID =
|
|
|
|
MVideoFile &
|
2019-08-20 13:52:49 +02:00
|
|
|
Use<'Video', MVideoUUID>
|
2019-08-15 11:53:26 +02:00
|
|
|
|
2020-01-31 16:56:52 +01:00
|
|
|
export type MVideoFileRedundanciesAll =
|
|
|
|
MVideoFile &
|
2020-01-10 10:11:28 +01:00
|
|
|
PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]>
|
|
|
|
|
2020-01-31 16:56:52 +01:00
|
|
|
export type MVideoFileRedundanciesOpt =
|
|
|
|
MVideoFile &
|
2019-08-15 11:53:26 +02:00
|
|
|
PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
|
2019-11-15 15:06:03 +01:00
|
|
|
|
|
|
|
export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist {
|
|
|
|
return !!file.videoStreamingPlaylistId
|
|
|
|
}
|
|
|
|
|
|
|
|
export function isWebtorrentFile (file: any): file is MVideoFileVideo {
|
|
|
|
return !!file.videoId
|
|
|
|
}
|