adding removing from redis where missing

This commit is contained in:
unknown 2023-03-05 11:44:45 +01:00
parent e00862f638
commit 27c79ab648
1 changed files with 4 additions and 1 deletions

View File

@ -44,6 +44,7 @@ exports.save = async (ws, req) => {
if (confirm) startDownloading() if (confirm) startDownloading()
else { else {
await redis.del(id)
ws.send('DATA - You little goofy goober tried to mess with the captcha...') ws.send('DATA - You little goofy goober tried to mess with the captcha...')
ws.close() ws.close()
} }
@ -99,6 +100,7 @@ exports.playlist = async (ws, req) => {
if (confirm) startDownloading() if (confirm) startDownloading()
else { else {
await redis.del(id)
ws.send('DATA - You little goofy goober tried to mess with the captcha...') ws.send('DATA - You little goofy goober tried to mess with the captcha...')
ws.close() ws.close()
} }
@ -146,6 +148,8 @@ exports.playlist = async (ws, req) => {
await redis.del(id) await redis.del(id)
continue continue
} else { } else {
await redis.del(id)
const file = fs.readdirSync("./videos").find(f => f.includes(id)) const file = fs.readdirSync("./videos").find(f => f.includes(id))
if (file) { if (file) {
fs.renameSync(`./videos/${file}`, `./videos/${id}.webm`) fs.renameSync(`./videos/${file}`, `./videos/${id}.webm`)
@ -158,7 +162,6 @@ exports.playlist = async (ws, req) => {
await websocket.createDatabaseVideo(id, videoUrl) await websocket.createDatabaseVideo(id, videoUrl)
ws.send(`DATA - Created video page for ${video.title}`) ws.send(`DATA - Created video page for ${video.title}`)
await redis.del(id)
} else { } else {
ws.send(`DATA - Failed to find file for ${video.title}. Going to next video in the playlist`) ws.send(`DATA - Failed to find file for ${video.title}. Going to next video in the playlist`)
continue continue