Skip to content

Commit

Permalink
json formatting reformat
Browse files Browse the repository at this point in the history
  • Loading branch information
lobsterchan27 committed Jun 12, 2024
1 parent 6d6b6f6 commit f931c12
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/audio.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const router = express.Router();
router.post('/generate/final', jsonParser, async function (request, response) {
console.log('Silence Stitching:');
const contextName = request.body.contextName;
console.log(contextName)
console.log(contextName);
const savepath = await audioSilenceStitch(contextName);
response.json({ savepath });
});
Expand Down
1 change: 1 addition & 0 deletions src/audioSilenceStitch.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ async function audioSilenceStitch(contextName) {
// console.log(prevEndTime);
}
// Save the updated contextChunks back to the JSON file
json.overlayAudio = path.basename(outputFile);
await saveJson(jsonPath, json);
} else {
console.log("subs already updated");
Expand Down
7 changes: 6 additions & 1 deletion src/youtube.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ router.post('/download/context', jsonParser, async function (request, response)
const contextPath = path.join('public', 'context', request.body.context);
const jsonPath = await getJson(contextPath, true);
const json = await loadJson(jsonPath);
const datasheetJsonPath = await getJson(contextPath);
const datasheetJson = await loadJson(datasheetJsonPath);
const url = json.webpage_url;
console.log('Downloading video:', url);
// const filename = ytdlpSanitize(json.title + '-' + json.id + '.mp4');
Expand Down Expand Up @@ -78,7 +80,10 @@ router.post('/download/context', jsonParser, async function (request, response)
const result = await ytDlpWrap.execPromise(options);
console.log(result);

const downloadedFile = parseFilenameFromResult(result);
const downloadedFile = path.basename(parseFilenameFromResult(result));
datasheetJson.original = downloadedFile;
await fs.promises.writeFile(datasheetJsonPath, JSON.stringify(datasheetJson, null, 2));

console.log('Downloaded file:', downloadedFile);

response.json({ filename: downloadedFile });
Expand Down

0 comments on commit f931c12

Please sign in to comment.