More robust indexify
This commit is contained in:
parent
948df5da9a
commit
2775eed077
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue