This repository has been archived by the owner on Oct 4, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
render.js
64 lines (54 loc) · 1.57 KB
/
render.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// render clips as video
// use frame dumps to do so
const chokidar = require('chokidar');
const _ = require('lodash');
const config = require('./config');
const path = require('path');
const fs = require('fs');
const { getAllTimestampsArr } = require('./api');
const { startTimestampObj, launchReplays } = require('./timestamp');
const dolphin_dump_video = path.resolve(config.framedump_dir, 'framedump0.avi');
const dolphin_dump_aduio0 = path.resolve(config.audiodump_dir, 'dspdump.wav');
const dolphin_dump_aduio1 = path.resolve(config.audiodump_dir, 'dtkdump.wav');
const example_ts = getAllTimestampsArr()[1];
function setFrameDump(offon) {
// assume on for now
return;
}
function initChokidar() {}
function preDumpCleanup() {
// remove pre-existing framedump0.avi files
for (const to_remove of [
dolphin_dump_video,
dolphin_dump_aduio0,
dolphin_dump_aduio1
]) {
if (fs.existsSync(to_remove)) {
fs.unlinkSync(to_remove);
}
}
}
function takeDumps(timestamps) {
preDumpCleanup();
// frame Dump must be ON
launchReplays(timestamps);
}
function afterDump(timestamp) {
const output_path = `renders/${timestamp.uid}+${timestamp.startFrame}+${timestamp.endFrame}.avi`;
fs.copyFile(dolphin_dump_video, output_path, () => {
console.log('wrote ' + output_path);
});
try {
// delete framedump
// fs.unlinkSync(dump_file);
//file removed
} catch (err) {
console.error(err);
}
}
function dumpTimestamp(timestamp) {
let ts = timestamp;
}
// takeDumps([ example_ts ]);
// afterDump(example_ts);
module.exports = { preDumpCleanup };