This commit is contained in:
Malte Münch 2020-01-30 18:34:56 +01:00
commit cae862d8bb
4 changed files with 291 additions and 0 deletions

47
setup.go Normal file
View File

@ -0,0 +1,47 @@
package spacepanel_aggregator
import (
"fmt"
yaml "gopkg.in/yaml.v2"
io "io/ioutil"
)
var listen = ":8080"
var conffile = "conf.yml"
var leds [][]string
func SetConf(s string) {
conffile = s
}
func SetIf(s string) {
listen = s
}
func Start() {
fmt.Println("Welcome to Spacepanel Aggregator!\n")
fmt.Println("Listen Interface: ", listen)
fmt.Println("Config-File: ", conffile)
bytes, err := io.ReadFile(conffile)
if err != nil {
ce(err)
}
err = yaml.Unmarshal(bytes, &leds)
if err != nil {
ce(err)
}
fmt.Println("So, lief anscheinend durch, schüss")
for i := 0; i < len(leds); i++ {
fmt.Println("-")
for j := 0; j < len(leds[i]); j++ {
fmt.Println(" -", leds[i][j])
}
}
}
func ce(err error) {
if err != nil {
fmt.Println("ERROR: ", err.Error())
}
}

View File

@ -0,0 +1,44 @@
package main
import (
"fmt"
"os"
sa "repos.ctdo.de/mamu/spacepanel_aggregator"
)
const helptext string = "spacepanel_aggregator usage: \n\n -l IF:port default: *:8080 \n -f config-file default: conf.yml \n -h print help and exit\n"
func main() {
conf := true
for i := 1; i < len(os.Args); i++ {
switch os.Args[i] {
case "-l":
i++
if i < len(os.Args) {
sa.SetIf(os.Args[i])
} else {
conf = false
}
case "-f":
i++
if i < len(os.Args) {
sa.SetConf(os.Args[i])
} else {
conf = false
}
default:
conf = false
i = len(os.Args)
}
}
if conf {
sa.Start()
} else {
printHelp()
}
}
func printHelp() {
fmt.Printf(helptext)
}

View File

@ -0,0 +1,184 @@
#led0:
-
- https://www.devtal.de/api/
#led1:
-
- https://www.binary-kitchen.de/spaceapi.php
#led2:
-
- https://status.aachen.ccc.de/spaceapi
#led3:
-
- https://schalter.ccchb.de/spaceapi.json
#led4:
-
- https://api.koeln.ccc.de
#led5:
-
- https://www.ccc-mannheim.de/spaceapi/spaceapi.json
#led6:
-
- http://cccfr.de/status/spaceapi.py
#led7:
-
- http://chaos-consulting.de/api/space.api
#led8:
-
- https://status.chaospott.de/status.json
#led9:
-
- https://chaoschemnitz.de/chch.json
#led10:
-
- https://www.ccc-p.org/spaceapi.json
#led11:
-
- http://doorstatus.c3re.de/status/json
#led12:
-
- http://status.ctdo.de/api/spaceapi/v13
#led13:
-
- https://status.diyww.de/status.json
#led14:
-
- http://club.entropia.de/spaceapi
#led15:
-
- https://fablab.fau.de/spaceapi/
#led16:
-
- https://spaceapi.futev.de/spaceapi.json
#led17:
-
- https://freieslabor.org/api/info
#led18:
-
- https://hackerspace-bielefeld.de/spacestatus/status.json
#led19:
-
- https://hacklabor.de/api/space/v1/
#led20:
-
- http://spaceapi.hacksaar.de/status.json
#led21:
-
- https://status.hasi.it/spaceapi
#led22:
-
- https://status.kraut.space/api
#led23:
-
- http://status.leinelab.org/api/spaceapi.json
#led24:
-
- http://status.mainframe.io/api/spaceInfo
#led25:
-
- http://spaceapi.n39.eu/json
#led26:
-
- http://netzladen.org/api/status.json
#led27:
-
- https://api.nerd2nerd.org/status.json
#led28:
-
- https://cccgoe.de/spaceapi.php
#led29:
-
- http://api.openlab-augsburg.de/data.json
#led30:
-
- https://werkraum.freiraumzittau.de/spaceapi/13/
#led31:
-
- https://spaceapi.reaktor23.org
#led32:
-
- http://status.stratum0.org/status.json
#led33:
-
- https://api.warpzone.ms/spaceapi
#led34:
-
- https://hsmr.cc/spaceapi.json
#led35:
-
- https://status.bckspc.de/spacestatus.php
#led36:
-
- http://stats.bytewerk.org/status.json
#led37:
-
- https://api.flipdot.org/
#led38:
-
- https://spaceapi.hackzogtum-coburg.de
#led39:
-
- https://state.maglab.space/spaceapi.json
#led40:
-
- http://nobreakspace.org/status/spaceapi.json
#led41:
-
- https://bodensee.space/spaceapi/see-base.json
#led42:
-
- https://api.shackspace.de/v1/spaceapi
#led43:
-
- https://verschwoerhaus.de/feed/spaceapi
#led44:
-
- https://vspace.one/spaceapi.json
#led45:
-
- https://keinanschluss.un-hack-bar.de/spaceapi.json
#led46:
-
- https://www.hackerspace-sw.de/spaceapi.json
#led47:
-
- https://hamburg.ccc.de/dooris/status.json
- http://blog.attraktor.org/spaceapi/spaceapi.json
#led48:
-
- https://status.makerspace-erfurt.de/status.json
- http://status.bytespeicher.org/status.json
#led49:
-
- http://status.munichmakerlab.de/spaceapi.php
- http://api.muc.ccc.de/spaceapi.json
#led50:
-
- http://api.terminal21.de
- http://api.terminal21.de/status_ebk.json
#led51:
-
- https://fnord.istsystemrelevant.de/spaceapi.json
- https://chaosdorf.de/space_api.json
#led52:
-
- http://spaceapi.nordlab-ev.de
- https://api.chaostreff-flensburg.de/
#led53:
-
- http://www.space-left.org/spaceapi13.json
- https://das-labor.org/status/api
#led54:
-
- http://www.turmlabor.de/spaces.api
- https://www.c3d2.de/spaceapi.json
#led55:
-
- http://spaceapi.k4cg.org/spaceapi.json
- http://api.fablab-nuernberg.de/spaceapi.php
- https://status.nerdberg.de/api/space
#led56:
-
- https://x-hain.de/spaceapi-0.13.json
- http://www.c-base.org/status.json
- https://spaceapi.motionlab.berlin/
- https://spaceapi.afra-berlin.de/v1/status.json

16
types.go Normal file
View File

@ -0,0 +1,16 @@
package spacepanel_aggregator
type State int
const (
Open State = iota
Close
Outdated
Unknown
)
var colors = [4]string{"#00ff00", "#ff0000", "#0000ff", "#000000"}
type Config struct {
Root [][]string
}