]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/typings/models/video/video-file.ts
Add ability to list redundancies
[github/Chocobozzz/PeerTube.git] / server / typings / models / video / video-file.ts
index 484351a8d03fdf4d4aaeaeb57104acc38038bf95..139b22b2c931b6ea37ad72333774385934c5ed08 100644 (file)
@@ -1,19 +1,37 @@
 import { VideoFileModel } from '../../../models/video/video-file'
 import { PickWith, PickWithOpt } from '../../utils'
 import { MVideo, MVideoUUID } from './video'
-import { MVideoRedundancyFileUrl } from './video-redundancy'
+import { MVideoRedundancy, MVideoRedundancyFileUrl } from './video-redundancy'
+import { MStreamingPlaylistVideo, MStreamingPlaylist } from './video-streaming-playlist'
 
 type Use<K extends keyof VideoFileModel, M> = PickWith<VideoFileModel, K, M>
 
 // ############################################################################
 
-export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos'>
+export type MVideoFile = Omit<VideoFileModel, 'Video' | 'RedundancyVideos' | 'VideoStreamingPlaylist'>
 
 export type MVideoFileVideo = MVideoFile &
   Use<'Video', MVideo>
 
+export type MVideoFileStreamingPlaylist = MVideoFile &
+  Use<'VideoStreamingPlaylist', MStreamingPlaylist>
+
+export type MVideoFileStreamingPlaylistVideo = MVideoFile &
+  Use<'VideoStreamingPlaylist', MStreamingPlaylistVideo>
+
 export type MVideoFileVideoUUID = MVideoFile &
   Use<'Video', MVideoUUID>
 
+export type MVideoFileRedundanciesAll = MVideoFile &
+  PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancy[]>
+
 export type MVideoFileRedundanciesOpt = MVideoFile &
   PickWithOpt<VideoFileModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
+
+export function isStreamingPlaylistFile (file: any): file is MVideoFileStreamingPlaylist {
+  return !!file.videoStreamingPlaylistId
+}
+
+export function isWebtorrentFile (file: any): file is MVideoFileVideo {
+  return !!file.videoId
+}