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));