From c8664f237562c888cde914e53e005e342c1e17b7 Mon Sep 17 00:00:00 2001 From: Thomas Forgione Date: Thu, 8 Oct 2020 16:33:30 +0200 Subject: [PATCH] Fix indexify --- indexify.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/indexify.js b/indexify.js index 4fea934..1c6e7e1 100644 --- a/indexify.js +++ b/indexify.js @@ -2,10 +2,15 @@ const fs = require('fs'); const path = require('path'); const VIDEO_DIR = "videos"; const DESCRIPTION_FILE = "description.json"; +const INDEX_FILE = "index.json"; let info = []; for (let dir of fs.readdirSync(VIDEO_DIR)) { + if (dir === INDEX_FILE) { + continue; + } + let description = JSON.parse(fs.readFileSync(path.join(VIDEO_DIR, dir, DESCRIPTION_FILE))); description.url = dir + "/"; description.videos = []; @@ -24,5 +29,5 @@ for (let dir of fs.readdirSync(VIDEO_DIR)) { info.push(description); } -fs.writeFileSync(path.join(VIDEO_DIR, 'index.json'), JSON.stringify(info)); +fs.writeFileSync(path.join(VIDEO_DIR, INDEX_FILE), JSON.stringify(info));