-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsingleSteps.js
43 lines (37 loc) · 1.31 KB
/
singleSteps.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
import fs from 'fs';
import chalk from 'chalk';
import { createSpinner } from 'nanospinner';
import { backup } from './backup.js';
import { doffmpeg } from './doffmpeg.js';
import { walkSync } from './walkSync.js';
export const singleBackup = async () => {
const spinner = createSpinner();
console.log(chalk.dim('\n === Backup files from SD card to external drive'));
spinner.start({ text: 'Start Backup...💾' });
await backup(globals.videoPaths);
spinner.success({ text: 'Backup Complete 🎉' });
};
export const singleCleanSource = async () => {
console.log(chalk.dim('\n === Cleaning SD Card'));
for (const videoFolder of globals.videoPaths) {
fs.rmSync(videoFolder, { recursive: true, force: true });
console.log(chalk.green('✔') + ` Removing ${videoFolder} 🎉`);
}
};
export const singleVideoCompression = async () => {
// read inventory.json from disk
const { missingCloudFiles } = JSON.parse(
fs.readFileSync('missingcloudfiles.json')
);
console.log(missingCloudFiles);
const subSpinner = createSpinner();
for (const [i, vid] of missingCloudFiles.entries()) {
subSpinner.start({
text: `Video ${i + 1} of ${missingCloudFiles.length}`,
});
await doffmpeg(vid);
subSpinner.success({
text: `Video ${i + 1} of ${missingCloudFiles.length} 🎉`,
});
}
};