X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=server%2Flib%2Fpaths.ts;h=470970f55f2b41777781c50c5bb9702690c26d70;hb=4cf800a350972a078c074da6b31da2b98ab4b007;hp=5a85bea4281b7672674036cfca6e38840d37218e;hpb=0628157fe9662fdb2b6fa658b8b53fe684c013ce;p=github%2FChocobozzz%2FPeerTube.git diff --git a/server/lib/paths.ts b/server/lib/paths.ts index 5a85bea42..470970f55 100644 --- a/server/lib/paths.ts +++ b/server/lib/paths.ts @@ -1,9 +1,10 @@ import { join } from 'path' import { CONFIG } from '@server/initializers/config' -import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants' +import { DIRECTORIES, VIDEO_LIVE } from '@server/initializers/constants' import { isStreamingPlaylist, MStreamingPlaylistVideo, MVideo, MVideoFile, MVideoUUID } from '@server/types/models' import { removeFragmentedMP4Ext } from '@shared/core-utils' import { buildUUID } from '@shared/extra-utils' +import { isVideoInPrivateDirectory } from './video-privacy' // ################## Video file name ################## @@ -17,16 +18,24 @@ function generateHLSVideoFilename (resolution: number) { // ################## Streaming playlist ################## -function getLiveDirectory (video: MVideoUUID) { +function getLiveDirectory (video: MVideo) { return getHLSDirectory(video) } -function getHLSDirectory (video: MVideoUUID) { - return join(HLS_STREAMING_PLAYLIST_DIRECTORY, video.uuid) +function getLiveReplayBaseDirectory (video: MVideo) { + return join(getLiveDirectory(video), VIDEO_LIVE.REPLAY_DIRECTORY) +} + +function getHLSDirectory (video: MVideo) { + if (isVideoInPrivateDirectory(video.privacy)) { + return join(DIRECTORIES.HLS_STREAMING_PLAYLIST.PRIVATE, video.uuid) + } + + return join(DIRECTORIES.HLS_STREAMING_PLAYLIST.PUBLIC, video.uuid) } function getHLSRedundancyDirectory (video: MVideoUUID) { - return join(HLS_REDUNDANCY_DIRECTORY, video.uuid) + return join(DIRECTORIES.HLS_REDUNDANCY, video.uuid) } function getHlsResolutionPlaylistFilename (videoFilename: string) { @@ -74,6 +83,7 @@ export { getHLSDirectory, getLiveDirectory, + getLiveReplayBaseDirectory, getHLSRedundancyDirectory, generateHLSMasterPlaylistFilename,