Browse Source

add run script

master
Yorick van Pelt 5 years ago
parent
commit
96fabd494a
  1. 10
      run.js
  2. 5
      tasks.js

10
run.js

@ -0,0 +1,10 @@
const Bravia = require('./bravia')
const tasks = require('./tasks')
const {ip, secret} = JSON.parse(require('fs').readFileSync("/home/yorick/.braviarc.json"))
const tv = new Bravia(ip, secret)
switch(process.argv[2]) {
case "on": tv.sendCommand("WakeUp"); break
case "off": tv.sendCommand("Sleep"); break
case "cmd": tv.sendCommand(process.argv[3]); break
default: if(process.argv[2] in tasks) tv.sequence(tasks[process.argv[2]])
}

5
tasks.js

@ -1,6 +1,7 @@
const {repeat} = require('./utils')
const utils = require('./utils')
const repeat = (...args) => Array.from(utils.repeat(...args))
const speakermenu = [
'WakeUp', 2000, 'Exit', 300, 'ActionMenu', 1000, repeat(['Up', 250], 9), repeat(['Down', 250], 7), 'DpadCenter', 1000
'WakeUp', 10000, 'Exit', 300, 'ActionMenu', 1000, repeat(['Up', 250], 9), repeat(['Down', 250], 7), 'DpadCenter', 1000
]
const speakermode = [speakermenu, 'Down', 500, 'DpadCenter', 500]

Loading…
Cancel
Save