-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.js
More file actions
73 lines (59 loc) · 2 KB
/
app.js
File metadata and controls
73 lines (59 loc) · 2 KB
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
65
66
67
68
69
70
71
72
const { indexLinks, processLineByLine } = require('./appFunc.js');
const chalk = require('chalk');
const prompt = require('prompt-sync')({
// history: require('prompt-sync-history')(),
// autocomplete: complete(['Index', 'Open', 'Media', 'LiveTV', '1', '5']),
sigint: true
});;
// indexLinks();
// processLineByLine('Media', 1, 5);
// runApp();
// async function runApp() {
// let again = 'again';
// while (again === 'again') {
// again = await app();
// }
// };
app(1);
function app(loop) {
const command = prompt(chalk.green("Enter Command: (Index/Open/EXIT)"));
if (command.toLocaleUpperCase().includes("INDEX")) {
const folder = prompt(chalk.blue("Enter Type: (Media/LiveTV)"));
console.log(folder);
if (folder.toLocaleUpperCase().includes("L")) {
indexLinks("LiveTV", loop, app);
}
else if (folder.toLocaleUpperCase().includes("M")) {
console.log("Indexing Media");
indexLinks("Media", loop, app);
}
else {
console.log("Invalid Type");
}
}
else if (command.toLocaleUpperCase().includes("OPEN")) {
const folder = prompt(chalk.blue("Enter Type: (Media/LiveTV)"));
if (folder.toLocaleUpperCase().includes("L")) {
const start = prompt(chalk.green("Enter Start: "));
const endIn = prompt(chalk.green("Enter End: "));
processLineByLine("LiveTV", start, endIn, loop, app);
}
else if (folder.toLocaleUpperCase().includes("M")) {
const start = prompt(chalk.green("Enter Start: "));
const endIn = prompt(chalk.green("Enter End: "));
processLineByLine("Media", start, endIn, loop, app);
}
else {
console.log("Invalid Type");
}
}
else if (command.toLocaleUpperCase().includes("EXIT")) {
return 'exit';
process.exit();
}
else {
console.log("Invalid Command");
app(loop);
}
return 'again'
}