remove all videos alr downloaded when boots

This commit is contained in:
unknown 2023-03-25 18:37:22 +01:00
parent 75a2bb37c3
commit ae865e007e
1 changed files with 6 additions and 1 deletions

View File

@ -1,4 +1,6 @@
const Redis = require('ioredis') const Redis = require('ioredis')
const fs = require('node:fs')
const logger = require("./logger.js") const logger = require("./logger.js")
const redis = new Redis({ const redis = new Redis({
@ -14,6 +16,9 @@ redis.on('ready', async function () {
const filteredKeys = keys.filter(key => !key.startsWith('blacklist:')) const filteredKeys = keys.filter(key => !key.startsWith('blacklist:'))
if (filteredKeys.length) await redis.del(filteredKeys) if (filteredKeys.length) await redis.del(filteredKeys)
}); const files = await fs.readdirSync('videos')
const webmFiles = files.filter((file) => file.endsWith('.webm'))
webmFiles.forEach((f) => fs.unlinkSync(`videos/${f}`))
})
module.exports = redis module.exports = redis