]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/video-paths.ts
Don't always replace actor avatar
[github/Chocobozzz/PeerTube.git] / server / lib / video-paths.ts
index 63011cdb2a12987b31f873284154e6a7cdd3e6e5..fe0a004e455b765d84724a25c1a0f1017b62ef3e 100644 (file)
@@ -1,8 +1,8 @@
-import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile } from '@server/typings/models'
+import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/typings/models'
 import { extractVideo } from './videos'
 import { join } from 'path'
 import { CONFIG } from '@server/initializers/config'
-import { HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
+import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
 
 // ################## Video file name ##################
 
@@ -34,6 +34,14 @@ function getVideoFilePath (videoOrPlaylist: MVideo | MStreamingPlaylistVideo, vi
   return join(baseDir, getVideoFilename(videoOrPlaylist, videoFile))
 }
 
+// ################## Streaming playlist ##################
+
+function getHLSDirectory (video: MVideoUUID, isRedundancy = false) {
+  const baseDir = isRedundancy ? HLS_REDUNDANCY_DIRECTORY : HLS_STREAMING_PLAYLIST_DIRECTORY
+
+  return join(baseDir, video.uuid)
+}
+
 // ################## Torrents ##################
 
 function getTorrentFileName (videoOrPlaylist: MVideo | MStreamingPlaylistVideo, videoFile: MVideoFile) {
@@ -60,5 +68,7 @@ export {
   getVideoFilePath,
 
   getTorrentFileName,
-  getTorrentFilePath
+  getTorrentFilePath,
+
+  getHLSDirectory
 }