aboutsummaryrefslogtreecommitdiffhomepage
path: root/scripts/prune-storage.ts
diff options
context:
space:
mode:
authorChocobozzz <me@florianbigard.com>2021-12-10 10:28:46 +0100
committerChocobozzz <me@florianbigard.com>2021-12-10 10:28:46 +0100
commit90701ec1d8d27d0072d6b0d2b19362d471484f9a (patch)
treea03dedc7b6119d9f6d2ea35cae9b2dde20275519 /scripts/prune-storage.ts
parent0fbc0dec59684527fad8772080a8e1f928c07ea1 (diff)
downloadPeerTube-90701ec1d8d27d0072d6b0d2b19362d471484f9a.tar.gz
PeerTube-90701ec1d8d27d0072d6b0d2b19362d471484f9a.tar.zst
PeerTube-90701ec1d8d27d0072d6b0d2b19362d471484f9a.zip
Add hls to prune storage script
Diffstat (limited to 'scripts/prune-storage.ts')
-rwxr-xr-xscripts/prune-storage.ts10
1 files changed, 9 insertions, 1 deletions
diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts
index 9df80d503..12d78fdc6 100755
--- a/scripts/prune-storage.ts
+++ b/scripts/prune-storage.ts
@@ -15,7 +15,8 @@ import { ActorImageModel } from '../server/models/actor/actor-image'
15import { uniq, values } from 'lodash' 15import { uniq, values } from 'lodash'
16import { ThumbnailType } from '@shared/models' 16import { ThumbnailType } from '@shared/models'
17import { VideoFileModel } from '@server/models/video/video-file' 17import { VideoFileModel } from '@server/models/video/video-file'
18import { HLS_REDUNDANCY_DIRECTORY } from '@server/initializers/constants' 18import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants'
19import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist'
19 20
20run() 21run()
21 .then(() => process.exit(0)) 22 .then(() => process.exit(0))
@@ -40,6 +41,9 @@ async function run () {
40 41
41 toDelete = toDelete.concat( 42 toDelete = toDelete.concat(
42 await pruneDirectory(CONFIG.STORAGE.VIDEOS_DIR, doesWebTorrentFileExist()), 43 await pruneDirectory(CONFIG.STORAGE.VIDEOS_DIR, doesWebTorrentFileExist()),
44
45 await pruneDirectory(HLS_STREAMING_PLAYLIST_DIRECTORY, doesHLSPlaylistExist()),
46
43 await pruneDirectory(CONFIG.STORAGE.TORRENTS_DIR, doesTorrentFileExist()), 47 await pruneDirectory(CONFIG.STORAGE.TORRENTS_DIR, doesTorrentFileExist()),
44 48
45 await pruneDirectory(CONFIG.STORAGE.REDUNDANCY_DIR, doesRedundancyExist), 49 await pruneDirectory(CONFIG.STORAGE.REDUNDANCY_DIR, doesRedundancyExist),
@@ -94,6 +98,10 @@ function doesWebTorrentFileExist () {
94 return (filePath: string) => VideoFileModel.doesOwnedWebTorrentVideoFileExist(basename(filePath)) 98 return (filePath: string) => VideoFileModel.doesOwnedWebTorrentVideoFileExist(basename(filePath))
95} 99}
96 100
101function doesHLSPlaylistExist () {
102 return (hlsPath: string) => VideoStreamingPlaylistModel.doesOwnedHLSPlaylistExist(basename(hlsPath))
103}
104
97function doesTorrentFileExist () { 105function doesTorrentFileExist () {
98 return (filePath: string) => VideoFileModel.doesOwnedTorrentFileExist(basename(filePath)) 106 return (filePath: string) => VideoFileModel.doesOwnedTorrentFileExist(basename(filePath))
99} 107}