summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2016-04-03 19:29:08 (GMT)
committerChristian Pointner <equinox@helsinki.at>2016-04-03 19:29:08 (GMT)
commit3e01ed80d3fe93ff8991958b5e7c622855a2dce1 (patch)
tree5c317abe5d375ff878043efdc22756f05d3f91cd /src
parentc20ae87122527771487d9f64ec8c0b243e8a63e4 (diff)
telnet: print brief summary for received state changes
Diffstat (limited to 'src')
-rw-r--r--src/rhctl/telnet.go28
1 files changed, 21 insertions, 7 deletions
diff --git a/src/rhctl/telnet.go b/src/rhctl/telnet.go
index 2623602..98dce0d 100644
--- a/src/rhctl/telnet.go
+++ b/src/rhctl/telnet.go
@@ -105,18 +105,32 @@ func telnetUpdateListener(c *telgo.Client, ctrl *SwitchControl) {
ctrl.Updates.Unsub(ch)
return
}
+ case SwitchState:
+ state := data.(SwitchState)
+ silence := "no output found in state??"
+ if len(state.Audio) > 0 {
+ if state.Audio[0].Silence {
+ silence = "output 1 is silent!!"
+ } else {
+ silence = "output 1 is noisy"
+ }
+ }
+ if !c.Sayln("audio-switch state: %s ... (use command 'state' for more info)", silence) {
+ ctrl.Updates.Unsub(ch)
+ return
+ }
case ServerState:
state := data.(ServerState)
if !c.Sayln("playout-server(%s): health=%s, channel=%s", state.Name, state.Health, state.Channel) {
ctrl.Updates.Unsub(ch)
return
}
- case SwitchState:
- //state := data.(SwitchState)
- // TODO: implement this
case State:
- //state := data.(State)
- // TOOD: implement this
+ state := data.(State)
+ if !c.Sayln("overall state: mood is %s ... (use command 'state' for more info)", state.Mood) {
+ ctrl.Updates.Unsub(ch)
+ return
+ }
default:
if !c.Sayln("unknown update of type: %T", data) {
ctrl.Updates.Unsub(ch)
@@ -140,7 +154,7 @@ func telnetCmdListen(c *telgo.Client, args []string, ctrl *SwitchControl) bool {
ch = c.UserData.(chan interface{})
}
- switch args[1] {
+ switch strings.ToLower(args[1]) {
case "state":
ctrl.Updates.AddSub(ch, "state")
case "server":
@@ -206,7 +220,7 @@ func telnetCmdSwitch(c *telgo.Client, args []string, ctrl *SwitchControl) bool {
func telnetHelp(c *telgo.Client, args []string) bool {
switch len(args) {
case 2:
- switch args[1] {
+ switch strings.ToLower(args[1]) {
case "quit":
c.Sayln("usage: quit")
c.Sayln(" terminates the client connection. You may also use Ctrl-D to do this.")