Fix indexify
This commit is contained in:
parent
1ba2bbd8ce
commit
c8664f2375
|
@ -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));
|
||||
|
||||
|
|
Loading…
Reference in New Issue