fix led order randomization
This commit is contained in:
parent
a91d6bc576
commit
d75584b4cf
114
conf.yml
114
conf.yml
|
@ -1,126 +1,126 @@
|
|||
led0:
|
||||
0:
|
||||
- https://www.devtal.de/api/
|
||||
led1:
|
||||
1:
|
||||
- https://www.binary-kitchen.de/spaceapi.php
|
||||
led2:
|
||||
2:
|
||||
- https://status.aachen.ccc.de/spaceapi
|
||||
led3:
|
||||
3:
|
||||
- https://schalter.ccchb.de/spaceapi.json
|
||||
led4:
|
||||
4:
|
||||
- https://api.koeln.ccc.de
|
||||
led5:
|
||||
5:
|
||||
- https://www.ccc-mannheim.de/spaceapi/spaceapi.json
|
||||
led6:
|
||||
6:
|
||||
- http://cccfr.de/status/spaceapi.py
|
||||
led7:
|
||||
7:
|
||||
- http://chaos-consulting.de/api/space.api
|
||||
led8:
|
||||
8:
|
||||
- https://status.chaospott.de/status.json
|
||||
led9:
|
||||
9:
|
||||
- https://chaoschemnitz.de/chch.json
|
||||
led10:
|
||||
10:
|
||||
- https://www.ccc-p.org/spaceapi.json
|
||||
led11:
|
||||
11:
|
||||
- http://doorstatus.c3re.de/status/json
|
||||
led12:
|
||||
12:
|
||||
- http://status.ctdo.de/api/spaceapi/v13
|
||||
led13:
|
||||
13:
|
||||
- https://status.diyww.de/status.json
|
||||
led14:
|
||||
14:
|
||||
- http://club.entropia.de/spaceapi
|
||||
led15:
|
||||
15:
|
||||
- https://fablab.fau.de/spaceapi/
|
||||
led16:
|
||||
16:
|
||||
- https://spaceapi.futev.de/spaceapi.json
|
||||
led17:
|
||||
17:
|
||||
- https://freieslabor.org/api/info
|
||||
led18:
|
||||
18:
|
||||
- https://hackerspace-bielefeld.de/spacestatus/status.json
|
||||
led19:
|
||||
19:
|
||||
- https://hacklabor.de/api/space/v1/
|
||||
led20:
|
||||
20:
|
||||
- http://spaceapi.hacksaar.de/status.json
|
||||
led21:
|
||||
21:
|
||||
- https://status.hasi.it/spaceapi
|
||||
led22:
|
||||
22:
|
||||
- https://status.kraut.space/api
|
||||
led23:
|
||||
23:
|
||||
- http://status.leinelab.org/api/spaceapi.json
|
||||
led24:
|
||||
24:
|
||||
- http://status.mainframe.io/api/spaceInfo
|
||||
led25:
|
||||
25:
|
||||
- http://spaceapi.n39.eu/json
|
||||
led26:
|
||||
26:
|
||||
- http://netzladen.org/api/status.json
|
||||
led27:
|
||||
27:
|
||||
- https://api.nerd2nerd.org/status.json
|
||||
led28:
|
||||
28:
|
||||
- https://cccgoe.de/spaceapi.php
|
||||
led29:
|
||||
29:
|
||||
- http://api.openlab-augsburg.de/data.json
|
||||
led30:
|
||||
30:
|
||||
- https://werkraum.freiraumzittau.de/spaceapi/13/
|
||||
led31:
|
||||
31:
|
||||
- https://spaceapi.reaktor23.org
|
||||
led32:
|
||||
32:
|
||||
- http://status.stratum0.org/status.json
|
||||
led33:
|
||||
33:
|
||||
- https://api.warpzone.ms/spaceapi
|
||||
led34:
|
||||
34:
|
||||
- https://hsmr.cc/spaceapi.json
|
||||
led35:
|
||||
35:
|
||||
- https://status.bckspc.de/spacestatus.php
|
||||
led36:
|
||||
36:
|
||||
- http://stats.bytewerk.org/status.json
|
||||
led37:
|
||||
37:
|
||||
- https://api.flipdot.org/
|
||||
led38:
|
||||
38:
|
||||
- https://spaceapi.hackzogtum-coburg.de
|
||||
led39:
|
||||
39:
|
||||
- https://state.maglab.space/spaceapi.json
|
||||
led40:
|
||||
40:
|
||||
- http://nobreakspace.org/status/spaceapi.json
|
||||
led41:
|
||||
41:
|
||||
- https://bodensee.space/spaceapi/see-base.json
|
||||
led42:
|
||||
42:
|
||||
- https://api.shackspace.de/v1/spaceapi
|
||||
led43:
|
||||
43:
|
||||
- https://verschwoerhaus.de/feed/spaceapi
|
||||
led44:
|
||||
44:
|
||||
- https://vspace.one/spaceapi.json
|
||||
led45:
|
||||
45:
|
||||
- https://keinanschluss.un-hack-bar.de/spaceapi.json
|
||||
led46:
|
||||
46:
|
||||
- https://www.hackerspace-sw.de/spaceapi.json
|
||||
led47:
|
||||
47:
|
||||
- https://hamburg.ccc.de/dooris/status.json
|
||||
- http://blog.attraktor.org/spaceapi/spaceapi.json
|
||||
led48:
|
||||
48:
|
||||
- https://status.makerspace-erfurt.de/status.json
|
||||
- http://status.bytespeicher.org/status.json
|
||||
led49:
|
||||
49:
|
||||
- http://status.munichmakerlab.de/spaceapi.php
|
||||
- http://api.muc.ccc.de/spaceapi.json
|
||||
led50:
|
||||
50:
|
||||
- http://api.terminal21.de
|
||||
- http://api.terminal21.de/status_ebk.json
|
||||
led51:
|
||||
51:
|
||||
- https://fnord.istsystemrelevant.de/spaceapi.json
|
||||
- https://chaosdorf.de/space_api.json
|
||||
led52:
|
||||
52:
|
||||
- http://spaceapi.nordlab-ev.de
|
||||
- https://api.chaostreff-flensburg.de/
|
||||
led53:
|
||||
53:
|
||||
- http://www.space-left.org/spaceapi13.json
|
||||
- https://das-labor.org/status/api
|
||||
led54:
|
||||
54:
|
||||
- http://www.turmlabor.de/spaces.api
|
||||
- https://www.c3d2.de/spaceapi.json
|
||||
led55:
|
||||
55:
|
||||
- http://spaceapi.k4cg.org/spaceapi.json
|
||||
- http://api.fablab-nuernberg.de/spaceapi.php
|
||||
- https://status.nerdberg.de/api/space
|
||||
led56:
|
||||
56:
|
||||
- https://x-hain.de/spaceapi-0.13.json
|
||||
- http://www.c-base.org/status.json
|
||||
- https://spaceapi.motionlab.berlin/
|
||||
|
|
2
main.go
2
main.go
|
@ -41,7 +41,7 @@ func main() {
|
|||
logrus.Fatal(err)
|
||||
}
|
||||
|
||||
var ledSpaceMap map[string][]string
|
||||
var ledSpaceMap map[int][]string
|
||||
err = yaml.Unmarshal(bytes, &ledSpaceMap)
|
||||
if err != nil {
|
||||
logrus.Fatalf("Error loading config file: %v", err)
|
||||
|
|
|
@ -30,7 +30,7 @@ type StateAggregator struct {
|
|||
mtx sync.RWMutex
|
||||
}
|
||||
|
||||
func NewStateAggregator(spaceList map[string][]string) *StateAggregator {
|
||||
func NewStateAggregator(spaceList map[int][]string) *StateAggregator {
|
||||
s := &StateAggregator{
|
||||
ledList: make(map[int][]*Space),
|
||||
}
|
||||
|
@ -63,11 +63,11 @@ func GetBestStateFromList(spaces []*Space) State {
|
|||
}
|
||||
|
||||
func (s *StateAggregator) GetLedStates() []string {
|
||||
var states []string
|
||||
states := make([]string, len(s.ledList))
|
||||
|
||||
s.mtx.RLock()
|
||||
for _, spaceList := range s.ledList {
|
||||
states = append(states, ColorMap[GetBestStateFromList(spaceList)])
|
||||
for i, spaceList := range s.ledList {
|
||||
states[i] = ColorMap[GetBestStateFromList(spaceList)]
|
||||
}
|
||||
s.mtx.RUnlock()
|
||||
|
||||
|
|
Loading…
Reference in New Issue