diff options
author | Christian Pointner <equinox@helsinki.at> | 2016-04-19 00:43:04 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2016-04-19 00:43:04 (GMT) |
commit | d2c51030a017133dd51d208dbe6954b070fb9cb9 (patch) | |
tree | e2b70e1d665af4602e5226227ef917ea6f7cbc4a /src/rhctl | |
parent | df0caeadd4412bc25573665cad3e6e49551a7163 (diff) |
rename switch ports to switch inputs @ config
Diffstat (limited to 'src/rhctl')
-rw-r--r-- | src/rhctl/conf.go | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/rhctl/conf.go b/src/rhctl/conf.go index bbf546c..36a3b5a 100644 --- a/src/rhctl/conf.go +++ b/src/rhctl/conf.go @@ -31,23 +31,23 @@ import ( "github.com/naoina/toml" ) -type ConfigSwitchPorts []struct { +type ConfigSwitchInputs []struct { Number SwitchInputNum `toml:"number"` Server string `toml:"server"` Channel string `toml:"channel"` } -func (p ConfigSwitchPorts) Len() int { return len(p) } -func (p ConfigSwitchPorts) Swap(i, j int) { p[i], p[j] = p[j], p[i] } -func (p ConfigSwitchPorts) Less(i, j int) bool { return p[i].Number < p[j].Number } +func (p ConfigSwitchInputs) Len() int { return len(p) } +func (p ConfigSwitchInputs) Swap(i, j int) { p[i], p[j] = p[j], p[i] } +func (p ConfigSwitchInputs) Less(i, j int) bool { return p[i].Number < p[j].Number } type Config struct { Audioswitch struct { - Device string `toml:"dev"` - Baudrate Baudrate `toml:"baud"` - Timeout Duration `toml:"timeout"` - Unit SwitchUnitID `toml:"unit"` - Ports ConfigSwitchPorts `toml:"ports"` + Device string `toml:"dev"` + Baudrate Baudrate `toml:"baud"` + Timeout Duration `toml:"timeout"` + Unit SwitchUnitID `toml:"unit"` + Inputs ConfigSwitchInputs `toml:"inputs"` } Servers map[string]struct { @@ -93,9 +93,9 @@ func ReadConfig(configfile string) (conf *Config, err error) { return } - sort.Sort(conf.Audioswitch.Ports) - for i := 1; i < len(conf.Audioswitch.Ports); i++ { - if conf.Audioswitch.Ports[i].Number == conf.Audioswitch.Ports[i-1].Number { + sort.Sort(conf.Audioswitch.Inputs) + for i := 1; i < len(conf.Audioswitch.Inputs); i++ { + if conf.Audioswitch.Inputs[i].Number == conf.Audioswitch.Inputs[i-1].Number { return nil, errors.New("audioswitch port assignments must be unique") } } |