X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;ds=sidebyside;f=scripts%2Fprune-storage.ts;h=4ab0b4863fd1ccff1aaaf4ff16652272be98787b;hb=6d8c8ea73a774c3568e6d28a4cbebcf7979d5c2a;hp=4088fa70046877e7a4620808b192f5addde15976;hpb=5ce1208a0a57d566b5b1fd57ec291a7d053ebaf0;p=github%2FChocobozzz%2FPeerTube.git diff --git a/scripts/prune-storage.ts b/scripts/prune-storage.ts index 4088fa700..4ab0b4863 100755 --- a/scripts/prune-storage.ts +++ b/scripts/prune-storage.ts @@ -5,6 +5,7 @@ import { VideoModel } from '../server/models/video/video' import { initDatabaseModels } from '../server/initializers' import { remove, readdir } from 'fs-extra' import { VideoRedundancyModel } from '../server/models/redundancy/video-redundancy' +import { getUUIDFromFilename } from '../server/helpers/utils' run() .then(() => process.exit(0)) @@ -82,15 +83,6 @@ async function pruneDirectory (directory: string, onlyOwned = false) { return toDelete } -function getUUIDFromFilename (filename: string) { - const regex = /[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}/ - const result = filename.match(regex) - - if (!result || Array.isArray(result) === false) return null - - return result[0] -} - async function askConfirmation () { return new Promise((res, rej) => { prompt.start()