From 9de52a0aa41f50f65e8f182f9730efbd736f6965 Mon Sep 17 00:00:00 2001 From: Determinant Date: Mon, 9 Sep 2024 17:19:54 -0700 Subject: ... --- app.mjs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app.mjs b/app.mjs index fa7ace7..5ad8793 100755 --- a/app.mjs +++ b/app.mjs @@ -155,13 +155,13 @@ const getIFREnroute = async () => { const getVFR = async () => { const secFiles = {}; for (const i of vfrSectional) { - const _region = i.replace(" ", "_"); + const _region = i.replaceAll(" ", "_"); secFiles[_region] = []; secFiles[_region].current = { date: moment(0) }; } const tacFiles = {}; for (const i of vfrTerminal) { - const _region = i.replace(" ", "_"); + const _region = i.replaceAll(" ", "_"); tacFiles[_region] = []; tacFiles[_region].current = { date: moment(0) }; } @@ -177,9 +177,9 @@ const getVFR = async () => { if (moment() >= date) { for (const region of vfrSectional) { const unzip = {}; - const _region = region.replace(" ", "_"); + const _region = region.replaceAll(" ", "_"); const url = `${vfrUrl}${m[1]}/sectional-files/${_region}.zip`; - unzip[`${region} SEC.tif`] = ".tif"; + unzip[`${_region}_SEC.tif`] = ".tif"; secFiles[_region].push({ url, date }); if (date > secFiles[_region].current.date) { secFiles[_region].current = { @@ -191,10 +191,10 @@ const getVFR = async () => { } for (const region of vfrTerminal) { const unzip = {}; - const _region = region.replace(" ", "_"); + const _region = region.replaceAll(" ", "_"); const url = `${vfrUrl}${m[1]}/tac-files/${_region}_TAC.zip`; - unzip[`${region} TAC.tif`] = ".tif"; - unzip[`${region} FLY.tif`] = "-flyway.tif"; + unzip[`${_region}_TAC.tif`] = ".tif"; + unzip[`${_region}_FLY.tif`] = "-flyway.tif"; tacFiles[_region].push({ url, date }); if (date > tacFiles[_region].current.date) { tacFiles[_region].current = { @@ -259,9 +259,9 @@ for (let r of res) { if (cur.unzip) { console.log(`extracting "${file}"`); await decompress(file, "./", { - filter: (f) => cur.unzip[f.path] != null, + filter: (f) => cur.unzip[f.path.replaceAll(" ", "_")] != null, map: (f) => { - f.path = `${chart_path}/${date}/${r.prefix}-${region.toLowerCase()}${cur.unzip[f.path]}`; + f.path = `${chart_path}/${date}/${r.prefix}-${region.toLowerCase()}${cur.unzip[f.path.replaceAll(" ", "_")]}`; return f; }, }); -- cgit v1.2.3-70-g09d2