PeerTube/server/typings/models/video/video-streaming-playlist.ts

44 lines
1.5 KiB
TypeScript
Raw Normal View History

2019-08-15 04:53:26 -05:00
import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
2019-08-21 07:31:57 -05:00
import { PickWith, PickWithOpt } from '../../utils'
2020-01-10 03:11:28 -06:00
import { MVideoRedundancyFileUrl, MVideoRedundancy } from './video-redundancy'
import { MVideo } from './video'
import { MVideoFile } from './video-file'
2019-08-15 04:53:26 -05:00
2019-08-20 06:52:49 -05:00
type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
// ############################################################################
export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>
2020-01-31 09:56:52 -06:00
export type MStreamingPlaylistFiles =
MStreamingPlaylist &
Use<'VideoFiles', MVideoFile[]>
2019-08-15 04:53:26 -05:00
2020-01-31 09:56:52 -06:00
export type MStreamingPlaylistVideo =
MStreamingPlaylist &
2019-08-20 06:52:49 -05:00
Use<'Video', MVideo>
2019-08-15 04:53:26 -05:00
2020-01-31 09:56:52 -06:00
export type MStreamingPlaylistFilesVideo =
MStreamingPlaylist &
Use<'VideoFiles', MVideoFile[]> &
Use<'Video', MVideo>
2020-01-31 09:56:52 -06:00
export type MStreamingPlaylistRedundanciesAll =
MStreamingPlaylist &
2020-01-10 03:11:28 -06:00
Use<'VideoFiles', MVideoFile[]> &
Use<'RedundancyVideos', MVideoRedundancy[]>
2020-01-31 09:56:52 -06:00
export type MStreamingPlaylistRedundancies =
MStreamingPlaylist &
Use<'VideoFiles', MVideoFile[]> &
2019-08-20 06:52:49 -05:00
Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
2019-08-21 07:31:57 -05:00
2020-01-31 09:56:52 -06:00
export type MStreamingPlaylistRedundanciesOpt =
MStreamingPlaylist &
Use<'VideoFiles', MVideoFile[]> &
2019-08-21 07:31:57 -05:00
PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo {
return !!(value as MStreamingPlaylist).playlistUrl
}