Files
rm-KSALDIS-DT/_hist/fix_all.js
T

20 lines
487 B
JavaScript

const fs = require('fs');
const path = require('path');
const p = 'descargar-curso/.mapa_videos.json';
let m = {};
try {
if (fs.existsSync(p)) {
m = JSON.parse(fs.readFileSync(p, 'utf-8'));
}
} catch (e) {}
const files = fs.readdirSync('descargar-curso/descargas/videos_offline');
for (const f of files) {
const match = f.match(/MX_video_(\d+)/);
if (match) {
m[match[1]] = f;
}
}
fs.writeFileSync(p, JSON.stringify(m, null, 2), "utf-8");
console.log("Map rebuilt.");