X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fvideo-paths.ts;h=05aaca8afd64ddc104df02be39fcca27dd08cf2a;hb=212e17a1892162a69138c0b9c0a1bd88f95209a8;hp=63011cdb2a12987b31f873284154e6a7cdd3e6e5;hpb=d7a25329f9e607894d29ab342b9cb66638b56dc0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/video-paths.ts b/server/lib/video-paths.ts index 63011cdb2..05aaca8af 100644 --- a/server/lib/video-paths.ts +++ b/server/lib/video-paths.ts @@ -1,8 +1,8 @@ -import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile } from '@server/typings/models' -import { extractVideo } from './videos' +import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/typings/models' 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' +import { extractVideo } from '@server/helpers/video' // ################## 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 }