add api client

- create,update,delete
This commit is contained in:
Garionion 2022-02-09 02:23:06 +01:00
parent c67cca9e11
commit ae87da080d
6 changed files with 127 additions and 72 deletions

View file

@ -24,7 +24,7 @@ type Berkutschi struct {
RX chan []byte
}
func Init(event int) *Berkutschi {
func Init(event int, ctx context.Context) *Berkutschi {
l := log.With().Int("event", event).Logger()
b := &Berkutschi{
event: event,

View file

@ -3,7 +3,6 @@ package client
import (
"context"
"git.entr0py.de/garionion/gstreamer-graphix/api"
"git.entr0py.de/garionion/gstreamer-graphix/gstreamer"
"github.com/rs/zerolog"
"github.com/rs/zerolog/log"
"google.golang.org/grpc"
@ -48,46 +47,3 @@ func (a *APIClient) UpdatePipeline(id string, overlays []*api.Overlay) error {
})
return err
}
func convertGstreamerOverlayToAPIOverlay(overlay gstreamer.Overlay) *api.Overlay {
switch overlay.(type) {
case *gstreamer.TextOverlay:
o := overlay.(*gstreamer.TextOverlay)
return &api.Overlay{
Name: o.Name,
X: int64(o.X),
Y: int64(o.Y),
Display: o.Display,
BlendIn: int64(o.BlendIn),
BlendOut: int64(o.BlendOut),
OverlayData: &api.Overlay_TextOverlay{
TextOverlay: &api.TextOverlay{
Text: o.Value,
FontName: o.Font,
FontSize: uint64(o.FontSize),
FontWeight: o.FontWeight,
FontColor: o.Color,
MaxWidth: uint64(o.MaxWidth),
},
},
}
case *gstreamer.ImageOverlay:
o := overlay.(*gstreamer.ImageOverlay)
return &api.Overlay{
Name: o.Name,
X: int64(o.X),
Y: int64(o.Y),
Display: o.Display,
BlendIn: int64(o.BlendIn),
BlendOut: int64(o.BlendOut),
OverlayData: &api.Overlay_ImageOverlay{
ImageOverlay: &api.ImageOverlay{
Path: o.Path,
},
},
}
}
return nil
}

14
go.mod
View file

@ -2,11 +2,11 @@ module git.entr0py.de/garionion/berkutschi
go 1.17
require (
git.entr0py.de/garionion/gstreamer-graphix v0.0.0-20220205233405-935e7232de45
git.entr0py.de/garionion/gstreamer-graphix v0.0.0-20220208230738-727ffafe5bee
github.com/disintegration/imaging v1.6.2
github.com/ilyakaznacheev/cleanenv v1.2.6
github.com/json-iterator/go v1.1.12
github.com/monaco-io/request v1.0.15
github.com/rs/zerolog v1.26.1
google.golang.org/grpc v1.44.0
@ -19,16 +19,18 @@ require (
github.com/google/uuid v1.3.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/joho/godotenv v1.4.0 // indirect
github.com/klauspost/compress v1.10.3 // indirect
github.com/klauspost/compress v1.14.2 // indirect
github.com/mattn/go-pointer v0.0.1 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/tinyzimmer/go-glib v0.0.24 // indirect
github.com/tinyzimmer/go-gst v0.2.32 // indirect
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 // indirect
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 // indirect
golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a // indirect
golang.org/x/sys v0.0.0-20220207234003-57398862261d // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20220204002441-d6cc3cc0770e // indirect
google.golang.org/genproto v0.0.0-20220208230804-65c12eb4c068 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect

26
go.sum
View file

@ -1,5 +1,9 @@
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
git.entr0py.de/garionion/gstreamer-graphix v0.0.0-20220205233405-935e7232de45 h1:74zaoFzQn4KtT3FwTqwYXzVi1r4fg4bAh6TXo1DiB1w=
git.entr0py.de/garionion/gstreamer-graphix v0.0.0-20220205233405-935e7232de45/go.mod h1:qMRyVH1rw+wfmXDus+WrkR2NA/9CnzXuq+dfNuXTemw=
git.entr0py.de/garionion/gstreamer-graphix v0.0.0-20220208230738-727ffafe5bee h1:6wiROfA6+eddHbCecprdt0pD7+afzeisM/M9l1ajL0k=
git.entr0py.de/garionion/gstreamer-graphix v0.0.0-20220208230738-727ffafe5bee/go.mod h1:qMRyVH1rw+wfmXDus+WrkR2NA/9CnzXuq+dfNuXTemw=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=
github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
@ -19,6 +23,7 @@ github.com/cncf/xds/go v0.0.0-20211011173535-cb28da3451f1/go.mod h1:eXthEFrGJvWH
github.com/coreos/go-systemd/v22 v22.3.2/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc=
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/disintegration/imaging v1.6.2 h1:w1LecBlG2Lnp8B3jk5zSuNqd7b4DXhcjwek1ei82L+c=
github.com/disintegration/imaging v1.6.2/go.mod h1:44/5580QXChDfwIclfc/PCwrr44amcmDAg8hxG0Ewe4=
@ -85,10 +90,14 @@ github.com/ilyakaznacheev/cleanenv v1.2.6/go.mod h1:C3bB+MJ+LjECYlw2k7CSagKGfL1Y
github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg=
github.com/joho/godotenv v1.4.0 h1:3l4+N6zfMWnkbPEXKng2o2/MR5mSwTrBih4ZEkkz1lg=
github.com/joho/godotenv v1.4.0/go.mod h1:f4LDr5Voq0i2e/R5DDNOoa2zzDfwtkZa6DnEwAbqwq4=
github.com/json-iterator/go v1.1.9 h1:9yzud/Ht36ygwatGx56VwCZtlI/2AD15T1X2sjSuGns=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/klauspost/compress v1.10.3 h1:OP96hzwJVBIHYU52pVTI6CczrxPvrGfgqF9N5eTO0Q8=
github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM=
github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=
github.com/klauspost/compress v1.14.1 h1:hLQYb23E8/fO+1u53d02A97a8UnsddcvYzq4ERRU4ds=
github.com/klauspost/compress v1.14.1/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/klauspost/compress v1.14.2 h1:S0OHlFk/Gbon/yauFJ4FfJJF5V0fc5HbBTJazi28pRw=
github.com/klauspost/compress v1.14.2/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=
github.com/kr/pretty v0.2.1 h1:Fmg33tUaq4/8ym9TJN1x7sLJnHVwhP33CNkpYV/7rwI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
@ -103,12 +112,16 @@ github.com/mattn/go-pointer v0.0.1 h1:n+XhsuGeVO6MEAp7xyEukFINEa+Quek5psIR/ylA6o
github.com/mattn/go-pointer v0.0.1/go.mod h1:2zXcozF6qYGgmsG+SeTZz3oAbFLdD3OWqnUbNvJZAlc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421 h1:ZqeYNhU3OHLH3mGKHDcjJRFFRrJa6eAM5H+CtDdOsPc=
github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742 h1:Esafd1046DLDQ0W1YjYsBW+p8U2u7vzgW2SQVmlNazg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg=
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M=
github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/monaco-io/request v1.0.15 h1:krhHE0yL6yL+xP0YwX5udyd+xnfQfHccop3Nsixec54=
github.com/monaco-io/request v1.0.15/go.mod h1:voq81GC2YDynQM3W/4D6oqGhqb+u7zULvbLzFkTmDfo=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
@ -120,6 +133,7 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/tinyzimmer/go-glib v0.0.24 h1:ktZZC22/9t88kGRgNEFV/SESgIWhGHE+q7Z7Qj++luw=
github.com/tinyzimmer/go-glib v0.0.24/go.mod h1:ltV0gO6xNFzZhsIRbFXv8RTq9NGoNT2dmAER4YmZfaM=
@ -138,6 +152,8 @@ golang.org/x/crypto v0.0.0-20211215165025-cf75a172585e/go.mod h1:P+XmwS30IXTQdn5
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8 h1:hVwzHzIUGRjiF7EcUjqNxk3NCfkPxbDKRdnNE1Rpg0U=
golang.org/x/image v0.0.0-20191009234506-e7c1f5e7dbb8/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410 h1:hTftEOvwiOq2+O8k2D5/Q7COC7k5Qcrgc2TFURJYnvQ=
golang.org/x/image v0.0.0-20211028202545-6944b10bf410/go.mod h1:023OzeP/+EPmXeapQh35lcL3II3LrY8Ic+EFFKVhULM=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
@ -176,6 +192,8 @@ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a h1:ppl5mZgokTT8uPkmYOyEUmPTr3ypaKkg5eFOGrAmxxE=
golang.org/x/sys v0.0.0-20220204135822-1c1b9b1eba6a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220207234003-57398862261d h1:Bm7BNOQt2Qv7ZqysjeLjgCBanX+88Z/OtdvsrEv1Djc=
golang.org/x/sys v0.0.0-20220207234003-57398862261d/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
@ -206,6 +224,8 @@ google.golang.org/genproto v0.0.0-20200513103714-09dca8ec2884/go.mod h1:55QSHmfG
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013/go.mod h1:NbSheEEYHJ7i3ixzK3sjbqSGDJWnxyFXZblF3eUsNvo=
google.golang.org/genproto v0.0.0-20220204002441-d6cc3cc0770e h1:hXl9hnyOkeznztYpYxVPAVZfPzcbO6Q0C+nLXodza8k=
google.golang.org/genproto v0.0.0-20220204002441-d6cc3cc0770e/go.mod h1:5CzLGKJ67TSI2B9POpiiyGha0AjJvZIUgRMt1dSmuhc=
google.golang.org/genproto v0.0.0-20220208230804-65c12eb4c068 h1:pwzFiZfBTH/GjBWz1BcDwMBaHBo8mZvpLa7eBKJpFAk=
google.golang.org/genproto v0.0.0-20220208230804-65c12eb4c068/go.mod h1:kGP+zUP2Ddo0ayMi4YuN7C3WZyJvGLZRh8Z5wnAqvEI=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyacEbxg=
google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY=

111
main.go
View file

@ -2,11 +2,14 @@ package main
import (
"context"
"encoding/json"
"flag"
"fmt"
"git.entr0py.de/garionion/berkutschi/client"
"git.entr0py.de/garionion/gstreamer-graphix/api"
"github.com/ilyakaznacheev/cleanenv"
jsoniter "github.com/json-iterator/go"
"github.com/rs/zerolog/pkgerrors"
"io/ioutil"
"os"
"strings"
"time"
@ -17,17 +20,20 @@ import (
"git.entr0py.de/garionion/berkutschi/berkutschi"
)
const logFile = "my.log"
type Config struct {
GstServer string `yaml:"gstServer"`
ImagePath string `yaml:"imagePath" env-default:"./images"`
Event int `yaml:"event"`
LogFile string `yaml:"logFile"`
GstServer string `yaml:"gstServer"`
ImagePath string `yaml:"imagePath" env-default:"./images"`
PositionsPath string `yaml:"positionsPath" env-default:"./positions.json"`
Event int `yaml:"event"`
LogFile string `yaml:"logFile"`
}
//TODO config struct thingy
var Judges = [5]JugdeRaceInfo{}
var PositionsConfig = Positions{}
var cfg Config
var json = jsoniter.ConfigCompatibleWithStandardLibrary
var apiClient *client.APIClient
func main() {
zerolog.TimeFieldFormat = time.RFC1123Z
@ -51,17 +57,27 @@ func main() {
zerolog.ErrorStackMarshaler = pkgerrors.MarshalStack
}
//TODO: error handling
jsonFile, err := os.Open(cfg.PositionsPath)
byteValue, _ := ioutil.ReadAll(jsonFile)
jsoniter.Unmarshal(byteValue, PositionsConfig)
apiClient = client.Init(cfg.GstServer)
pollData, err := berkutschi.Poll(cfg.Event)
if err != nil {
log.Panic().Err(fmt.Errorf("Error while polling: %s", err)).Send()
}
fillJudgeraceinfo(pollData)
b := berkutschi.Init(cfg.Event)
ctx, _ := context.WithCancel(context.Background())
b := berkutschi.Init(cfg.Event, ctx)
go func() {
jumperInfoMap := make(map[string]string)
jumperScoreMap := make(map[string]string)
jumperInfo := JumperInfo{}
jumperscore := JumperScore{}
jumperScore := JumperScore{}
for {
message := <-b.RX
var jumpMessage BerkutschiJumpUpdateMessages
@ -73,13 +89,51 @@ func main() {
continue
}
if newJumperInfoData(jumperInfo, jumper) {
jumperInfo = jumper
log.Info().Msgf("New jumper info: %+v", jumperInfo)
if jumper.Name == jumperInfo.Name {
overlays, _ := jumper.convertToAPIOverlays(PositionsConfig)
err = apiClient.UpdatePipeline(jumperInfoMap[jumper.Name], overlays)
if err != nil {
log.Error().Err(err).Msgf("Error while updating jumperinfo of %s pipeline", jumper.Name)
}
} else {
id, err := jumper.createPipeline()
if err != nil {
log.Error().Err(err).Msgf("Error while creating jumperInfo pipeline for %s", jumper.Name)
}
log.Info().Msgf("Created jumperInfo pipeline for %s", jumper.Name)
jumperInfoMap[jumper.Name] = id
err = apiClient.DeletePipeline(jumperInfoMap[jumperInfo.Name])
if err != nil {
log.Error().Err(err).Msgf("Error while deleting pipeline of %s", jumperInfo.Name)
}
delete(jumperInfoMap, jumperInfo.Name)
}
jumperInfo = jumper
}
score, _ := fillJumperScore(jumpMessage)
if score.Rank != 0 && newJumperScoreData(jumperscore, score) {
jumperscore = score
log.Info().Msgf("New jumper score: %+v", jumperscore)
if score.Rank != 0 && newJumperScoreData(jumperScore, score) {
log.Info().Msgf("New jumper score: %+v", jumperScore)
if jumperScore.Name == score.Name {
overlays, _ := score.convertToAPIOverlays(PositionsConfig)
err = apiClient.UpdatePipeline(jumperScoreMap[jumperScore.Name], overlays)
if err != nil {
log.Error().Err(err).Msgf("Error while updating jumperScore of %s pipeline", jumperScore.Name)
}
} else {
id, err := score.createPipeline()
if err != nil {
log.Error().Err(err).Msgf("Error while creating jumperScore pipeline for %s", score.Name)
}
log.Info().Msgf("Created jumperScore pipeline for %s", score.Name)
jumperScoreMap[score.Name] = id
err = apiClient.DeletePipeline(jumperScoreMap[jumperScore.Name])
if err != nil {
log.Error().Err(err).Msgf("Error while deleting pipeline of %s", jumperScore.Name)
}
delete(jumperScoreMap, jumperScore.Name)
}
jumperScore = score
}
} else if err != nil {
log.Error().RawJSON("receivedMessage", message).Err(fmt.Errorf("%v", err))
@ -91,12 +145,35 @@ func main() {
}
}()
ctx, _ := context.WithCancel(context.Background())
<-ctx.Done()
}
func (d JumperInfo) createPipeline() (string, error) {
overlays := d.convertToAPIOverlays()
overlays, err := d.convertToAPIOverlays(PositionsConfig)
if err != nil {
return "", err
}
pipeline := &api.Pipeline{
Name: "jumperinfo",
Clip: "CoC_20_Jumper_Infos_Fast.raw",
Output: "decklinkvideosink",
Overlays: overlays,
}
return apiClient.CreatePipeline(pipeline)
}
func (d JumperScore) createPipeline() (string, error) {
overlays, err := d.convertToAPIOverlays(PositionsConfig)
if err != nil {
return "", err
}
pipeline := &api.Pipeline{
Name: "jumperscore",
Clip: "CoC_20_Jumper_Score_Fast.raw",
Output: "decklinkvideosink",
Overlays: overlays,
}
return apiClient.CreatePipeline(pipeline)
}
func fillJumperInfo(m BerkutschiJumpUpdateMessages) (JumperInfo, error) {
@ -128,7 +205,7 @@ func fillJumperScore(m BerkutschiJumpUpdateMessages) (JumperScore, error) {
JumperScore.Rank = m[0].Data.Current.Cumul.Rank
JumperScore.Wind = m[0].Data.Current.Wind.Wind
JumperScore.Length = fmt.Sprintf("%vm", m[0].Data.Current.Length.Length)
for i, _ := range JumperScore.Judges {
for i := range JumperScore.Judges {
switch i {
case 0:
JumperScore.Judges[i].Score = m[0].Data.Current.Judge.One.Rate
@ -157,7 +234,7 @@ func fillJumperScore(m BerkutschiJumpUpdateMessages) (JumperScore, error) {
}
func fillJudgeraceinfo(data berkutschi.PollData) {
for i, _ := range Judges {
for i := range Judges {
switch i {
case 0:
Judges[i].Nation = strings.ToUpper(data.Data.Raceinfo.Judges.One.Nation)

View file

@ -21,7 +21,7 @@ pkgs.buildGo117Module {
allowGoReference = true;
vendorSha256 = "sha256-qXi32q5PjnvYj6LUUTT9vF3VICj6mFnMUdVA1FJMSD0=";
vendorSha256 = "sha256-AYhWhj9hu9laRgYf0zk9ZVHxrgqcGTEfjHoPP93Wodg=";
meta = {
description = "A Client for the Berkutschi WS Api";