diff --git a/indexify.js b/indexify.js index 1c6e7e1..7925e4f 100644 --- a/indexify.js +++ b/indexify.js @@ -4,10 +4,14 @@ const VIDEO_DIR = "videos"; const DESCRIPTION_FILE = "description.json"; const INDEX_FILE = "index.json"; +function isDirectory(path) { + return fs.lstatSync(path).isDirectory(); +} + let info = []; for (let dir of fs.readdirSync(VIDEO_DIR)) { - if (dir === INDEX_FILE) { + if (!isDirectory(path.join(VIDEO_DIR, dir))) { continue; } @@ -16,7 +20,7 @@ for (let dir of fs.readdirSync(VIDEO_DIR)) { description.videos = []; for (let subdir of fs.readdirSync(path.join(VIDEO_DIR, dir))) { - if (subdir === DESCRIPTION_FILE) { + if (!isDirectory(path.join(VIDEO_DIR, dir, subdir))) { continue; }