-
Notifications
You must be signed in to change notification settings - Fork 1
/
action.js
51 lines (39 loc) · 821 Bytes
/
action.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
44
45
46
47
48
49
50
51
const device = require('./device');
if (process.argv.length < 3) {
console.log('用法: node action.js 操作');
process.exit(1);
}
const action = process.argv[2];
const main = async () => {
switch (action) {
default:
case 'status':
console.log(await device.getStatus());
break;
case 'play':
device.play();
break;
case 'stop':
device.stop();
break;
case 'pause':
device.pause();
break;
case 'next':
device.next();
break;
case 'previous':
device.previous();
break;
case 'info':
console.log(await device.getInfo());
break;
case 'mode':
device.setPlayMode(process.argv[3]);
break;
case 'volume':
device.setVolume(process.argv[3] ?? 20);
break;
}
}
main();