diff options
author | Chocobozzz <me@florianbigard.com> | 2021-12-10 10:28:46 +0100 |
---|---|---|
committer | Chocobozzz <me@florianbigard.com> | 2021-12-10 10:28:46 +0100 |
commit | 90701ec1d8d27d0072d6b0d2b19362d471484f9a (patch) | |
tree | a03dedc7b6119d9f6d2ea35cae9b2dde20275519 /scripts/prune-storage.ts | |
parent | 0fbc0dec59684527fad8772080a8e1f928c07ea1 (diff) | |
download | PeerTube-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-x | scripts/prune-storage.ts | 10 |
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' | |||
15 | import { uniq, values } from 'lodash' | 15 | import { uniq, values } from 'lodash' |
16 | import { ThumbnailType } from '@shared/models' | 16 | import { ThumbnailType } from '@shared/models' |
17 | import { VideoFileModel } from '@server/models/video/video-file' | 17 | import { VideoFileModel } from '@server/models/video/video-file' |
18 | import { HLS_REDUNDANCY_DIRECTORY } from '@server/initializers/constants' | 18 | import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants' |
19 | import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' | ||
19 | 20 | ||
20 | run() | 21 | run() |
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 | ||
101 | function doesHLSPlaylistExist () { | ||
102 | return (hlsPath: string) => VideoStreamingPlaylistModel.doesOwnedHLSPlaylistExist(basename(hlsPath)) | ||
103 | } | ||
104 | |||
97 | function doesTorrentFileExist () { | 105 | function doesTorrentFileExist () { |
98 | return (filePath: string) => VideoFileModel.doesOwnedTorrentFileExist(basename(filePath)) | 106 | return (filePath: string) => VideoFileModel.doesOwnedTorrentFileExist(basename(filePath)) |
99 | } | 107 | } |