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