-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
60 lines (46 loc) · 1.6 KB
/
app.js
File metadata and controls
60 lines (46 loc) · 1.6 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
const config = require('./settings.json')
const fs = require('fs')
var util = require('util');
var $ = require('jquery')
var log_file = fs.createWriteStream(__dirname + '/logs/debug.log', {flags : 'w'});
var log_stdout = process.stdout;
const get_title = require('./src/js/modules/title')
const download = require('./src/js/modules/download-new')
const rename = require('./src/js/modules/rename')
const encode = require('./src/js/modules/encode')
const upload = require('./src/js/modules/upload')
const assureDirs = require('./src/js/modules/assureDirs')
const timeHandler = require('./src/js/modules/timeHandler')
//logging to log file
log = function(a) { //
log_file.write(util.format(a) + '\n');
log_stdout.write(util.format(a) + '\n');
if (config.debug) {console.log(a)}
};
//Starts the program when the button is clicked
$('#begin').click(main)
//Main function
async function main() {
//sets the start time
timeHandler.startTime()
//Makes sure all the neccessary directories are in place
assureDirs()
//Gets the sermon title
let title = get_title()
if (title) {
//If the download was successful go on, else log the error
if (await download()) {
console.log("Rename")
//Start Doing more cool stuff here
rename.audio(title)
rename.video(title)
//wait till encoding is done
await encode(title)
//upload audio and video to the ftps
await upload(title)
timeHandler.endTime()
timeHandler.elapsedTime()
}
}
}
//Function Definitions