-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinit.js
34 lines (28 loc) · 937 Bytes
/
init.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
//
// This module initializes persistent storage and starts a very slow movie
//
const probe = require("ffmpeg-probe");
const storage = require("node-persist");
async function getInfo(file) {
const info = await probe(file);
const numFramesTotal = parseInt(info.streams[0].nb_frames);
const r_frame_rate = eval(info.streams[0].r_frame_rate);
// console.log(info);
// console.log(numFramesTotal);
console.log("Movie file: " + file);
console.log("Frame rate: " + r_frame_rate);
console.log("Total frames: " + numFramesTotal);
await storage.init({
dir: "./config"
});
await storage.setItem("totalFrames", numFramesTotal);
await storage.setItem("movieFile", file);
await storage.setItem("currentFrame", 0);
await storage.setItem("frameRate", r_frame_rate);
}
const args = process.argv.slice(2);
if (args.length != 1) {
console.log("Must provide movie file as argument");
} else {
getInfo(args[0]);
}