]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/lib/object-storage/videos.ts
Merge branch 'release/4.3.0' into develop
[github/Chocobozzz/PeerTube.git] / server / lib / object-storage / videos.ts
index 8988f3e2a09d1daa8093e78913b25d7f668c09bc..66e738200ed329e2c7918b656c9b99bf78922374 100644 (file)
@@ -6,11 +6,9 @@ import { getHLSDirectory } from '../paths'
 import { generateHLSObjectBaseStorageKey, generateHLSObjectStorageKey, generateWebTorrentObjectStorageKey } from './keys'
 import { lTags, makeAvailable, removeObject, removePrefix, storeObject } from './shared'
 
-function storeHLSFile (playlist: MStreamingPlaylistVideo, filename: string) {
-  const baseHlsDirectory = getHLSDirectory(playlist.Video)
-
+function storeHLSFile (playlist: MStreamingPlaylistVideo, filename: string, path?: string) {
   return storeObject({
-    inputPath: join(baseHlsDirectory, filename),
+    inputPath: path ?? join(getHLSDirectory(playlist.Video), filename),
     objectStorageKey: generateHLSObjectStorageKey(playlist, filename),
     bucketInfo: CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS
   })
@@ -28,6 +26,10 @@ function removeHLSObjectStorage (playlist: MStreamingPlaylistVideo) {
   return removePrefix(generateHLSObjectBaseStorageKey(playlist), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS)
 }
 
+function removeHLSFileObjectStorage (playlist: MStreamingPlaylistVideo, filename: string) {
+  return removeObject(generateHLSObjectStorageKey(playlist, filename), CONFIG.OBJECT_STORAGE.STREAMING_PLAYLISTS)
+}
+
 function removeWebTorrentObjectStorage (videoFile: MVideoFile) {
   return removeObject(generateWebTorrentObjectStorageKey(videoFile.filename), CONFIG.OBJECT_STORAGE.VIDEOS)
 }
@@ -65,6 +67,7 @@ export {
   storeHLSFile,
 
   removeHLSObjectStorage,
+  removeHLSFileObjectStorage,
   removeWebTorrentObjectStorage,
 
   makeWebTorrentFileAvailable,