-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.js
More file actions
48 lines (40 loc) · 1.31 KB
/
index.js
File metadata and controls
48 lines (40 loc) · 1.31 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
const dir = require('./libs/dir')
const actions = require('./libs/actions')
const vorpal = require('vorpal')()
const recorder = require('./libs/recorder')
dir.makeDirStructure()
vorpal
.command('recorder', 'A TS live stream recorder')
.option('-l --list', 'List All Channels')
.option('-d --dvr <id>', 'Start recording on channel number')
.option('-r --reload', 'Reload channel list')
.action(actions.recorder)
vorpal
.command('setaddr <addr>', 'change live m3u list location')
.action(actions.setM3UAddr)
vorpal.command('updatem3u', 'update m3u file').action(actions.updateM3UFile)
vorpal
.command('getconfig [key]', 'view all or specific config')
.action(function(args, callback) {
this.log(args.key ? dir.readConfig()[args.key] : dir.readConfig())
callback()
})
vorpal
.command('state', 'view current tasks')
.action(recorder.logScreen)
vorpal
.command('stop [task]', 'stop specific task')
.action(recorder.stopTask)
console.log('checking env...')
recorder.envCheck().then(env => {
if (env.ffmpeg) {
console.log(`Found FFMPEG ${env.version}`)
if (!env.ssl)
console.warn(
'Current FFMPEG has not ssl support, if the stream is https based will failed to record',
)
vorpal.delimiter('IPTVRecorder > ').show()
} else {
console.log('NO FFMPEG FOUND!')
}
})