]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/typings/models/video/video-streaming-playlist.ts
Add ability to disable webtorrent
[github/Chocobozzz/PeerTube.git] / server / typings / models / video / video-streaming-playlist.ts
index 79696bcff69cb6ebc9173ca267eb320c8d6c91d6..436c0c0726a9db50e9b2c88705a5819b6ea21225 100644 (file)
@@ -1,19 +1,33 @@
 import { VideoStreamingPlaylistModel } from '../../../models/video/video-streaming-playlist'
 import { PickWith, PickWithOpt } from '../../utils'
 import { MVideoRedundancyFileUrl } from './video-redundancy'
-import { MVideo, MVideoUrl } from '@server/typings/models'
+import { MVideo } from './video'
+import { MVideoFile } from './video-file'
 
 type Use<K extends keyof VideoStreamingPlaylistModel, M> = PickWith<VideoStreamingPlaylistModel, K, M>
 
 // ############################################################################
 
-export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos'>
+export type MStreamingPlaylist = Omit<VideoStreamingPlaylistModel, 'Video' | 'RedundancyVideos' | 'VideoFiles'>
+
+export type MStreamingPlaylistFiles = MStreamingPlaylist &
+  Use<'VideoFiles', MVideoFile[]>
 
 export type MStreamingPlaylistVideo = MStreamingPlaylist &
   Use<'Video', MVideo>
 
+export type MStreamingPlaylistFilesVideo = MStreamingPlaylist &
+  Use<'VideoFiles', MVideoFile[]> &
+  Use<'Video', MVideo>
+
 export type MStreamingPlaylistRedundancies = MStreamingPlaylist &
+  Use<'VideoFiles', MVideoFile[]> &
   Use<'RedundancyVideos', MVideoRedundancyFileUrl[]>
 
 export type MStreamingPlaylistRedundanciesOpt = MStreamingPlaylist &
+  Use<'VideoFiles', MVideoFile[]> &
   PickWithOpt<VideoStreamingPlaylistModel, 'RedundancyVideos', MVideoRedundancyFileUrl[]>
+
+export function isStreamingPlaylist (value: MVideo | MStreamingPlaylistVideo): value is MStreamingPlaylistVideo {
+  return !!(value as MStreamingPlaylist).playlistUrl
+}