1
0
Fork 0
peertube/server/typings/models/video/video-redundancy.ts
Chocobozzz d7a25329f9
Add ability to disable webtorrent
In favour of HLS
2019-11-25 10:59:43 +01:00

38 lines
1.7 KiB
TypeScript

import { VideoRedundancyModel } from '../../../models/redundancy/video-redundancy'
import { PickWith, PickWithOpt } from '@server/typings/utils'
import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
import { VideoFileModel } from '@server/models/video/video-file'
import { MVideoFile, MVideoFileVideo } from './video-file'
import { MStreamingPlaylistVideo } from './video-streaming-playlist'
import { MVideoUrl } from './video'
type Use<K extends keyof VideoRedundancyModel, M> = PickWith<VideoRedundancyModel, K, M>
// ############################################################################
export type MVideoRedundancy = Omit<VideoRedundancyModel, 'VideoFile' | 'VideoStreamingPlaylist' | 'Actor'>
export type MVideoRedundancyFileUrl = Pick<MVideoRedundancy, 'fileUrl'>
// ############################################################################
export type MVideoRedundancyFile = MVideoRedundancy &
Use<'VideoFile', MVideoFile>
export type MVideoRedundancyFileVideo = MVideoRedundancy &
Use<'VideoFile', MVideoFileVideo>
export type MVideoRedundancyStreamingPlaylistVideo = MVideoRedundancy &
Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
export type MVideoRedundancyVideo = MVideoRedundancy &
Use<'VideoFile', MVideoFileVideo> &
Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
// ############################################################################
// Format for API or AP object
export type MVideoRedundancyAP = MVideoRedundancy &
PickWithOpt<VideoRedundancyModel, 'VideoFile', MVideoFile & PickWith<VideoFileModel, 'Video', MVideoUrl>> &
PickWithOpt<VideoRedundancyModel, 'VideoStreamingPlaylist', PickWith<VideoStreamingPlaylistModel, 'Video', MVideoUrl>>