Skip to content

armgit / my-yt

Public Imported from GitHub
0

A clean and minimal youtube frontend, without all the ads and whistles

JavaScript

fix: disk usage handler wrongly marked downloaded videos

Christian Fei563aada28df6
diff --git a/lib/server.js b/lib/server.js
index 4138649..f9100a2 100644
--- a/lib/server.js
+++ b/lib/server.js
@@ -346,12 +346,7 @@ function diskUsageHandler(req, res, repo) {
.reduce((total, video) => {
try {
const files = fs.globSync(`./data/videos/${video.id}*`)
- total += files.reduce((acc, file) => {
- const filesize = fs.statSync(file).size / Math.pow(10, 9)
- return acc + filesize
- }, 0)
- repo.setVideoDownloaded(video.id, false)
- return total
+ return total + files.reduce((acc, file) => acc + fs.statSync(file).size / Math.pow(10, 9), 0)
} catch (err) {
console.error(err)
return total