X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=scripts%2Fprune-storage.ts;h=12d78fdc6d3b5aa4d095440d26707afa879f9f0d;hb=1e9c1b1b44b4cbd4bc4b1e97e8e6ba2df93371de;hp=9df80d5035154cb2eb8d1a6f257eed26f90a6d79;hpb=2ede07153ce0282b116345dfee09bff902355a75;p=github%2FChocobozzz%2FPeerTube.git 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' import { uniq, values } from 'lodash' import { ThumbnailType } from '@shared/models' import { VideoFileModel } from '@server/models/video/video-file' -import { HLS_REDUNDANCY_DIRECTORY } from '@server/initializers/constants' +import { HLS_REDUNDANCY_DIRECTORY, HLS_STREAMING_PLAYLIST_DIRECTORY } from '@server/initializers/constants' +import { VideoStreamingPlaylistModel } from '@server/models/video/video-streaming-playlist' run() .then(() => process.exit(0)) @@ -40,6 +41,9 @@ async function run () { toDelete = toDelete.concat( await pruneDirectory(CONFIG.STORAGE.VIDEOS_DIR, doesWebTorrentFileExist()), + + await pruneDirectory(HLS_STREAMING_PLAYLIST_DIRECTORY, doesHLSPlaylistExist()), + await pruneDirectory(CONFIG.STORAGE.TORRENTS_DIR, doesTorrentFileExist()), await pruneDirectory(CONFIG.STORAGE.REDUNDANCY_DIR, doesRedundancyExist), @@ -94,6 +98,10 @@ function doesWebTorrentFileExist () { return (filePath: string) => VideoFileModel.doesOwnedWebTorrentVideoFileExist(basename(filePath)) } +function doesHLSPlaylistExist () { + return (hlsPath: string) => VideoStreamingPlaylistModel.doesOwnedHLSPlaylistExist(basename(hlsPath)) +} + function doesTorrentFileExist () { return (filePath: string) => VideoFileModel.doesOwnedTorrentFileExist(basename(filePath)) }