diff --git a/db/migrations/20140524160241_CreateEventSettings.sql b/db/migrations/20140524160241_CreateEventSettings.sql index cbfa345..e1000af 100644 --- a/db/migrations/20140524160241_CreateEventSettings.sql +++ b/db/migrations/20140524160241_CreateEventSettings.sql @@ -23,8 +23,6 @@ CREATE TABLE event_settings ( tbadownloadenabled bool, adminpassword VARCHAR(255), readerpassword VARCHAR(255), - stemtvpublishingenabled bool, - stemtveventcode VARCHAR(16), scaleledaddress VARCHAR(255), redswitchledaddress VARCHAR(255), blueswitchledaddress VARCHAR(255), diff --git a/field/arena.go b/field/arena.go index 3c7f468..451c305 100644 --- a/field/arena.go +++ b/field/arena.go @@ -48,7 +48,6 @@ type Arena struct { networkSwitch *NetworkSwitch Plc plc.Plc TbaClient *partner.TbaClient - StemTvClient *partner.StemTvClient AllianceStations map[string]*AllianceStation Displays map[string]*Display ArenaNotifiers @@ -148,7 +147,6 @@ func (arena *Arena) LoadSettings() error { arena.networkSwitch = NewNetworkSwitch(settings.SwitchAddress, settings.SwitchPassword) arena.Plc.SetAddress(settings.PlcAddress) arena.TbaClient = partner.NewTbaClient(settings.TbaEventCode, settings.TbaSecretId, settings.TbaSecret) - arena.StemTvClient = partner.NewStemTvClient(settings.StemTvEventCode) if arena.EventSettings.NetworkSecurityEnabled { if err = arena.accessPoint.ConfigureAdminWifi(); err != nil { diff --git a/model/event_settings.go b/model/event_settings.go index bea7525..068282b 100644 --- a/model/event_settings.go +++ b/model/event_settings.go @@ -6,35 +6,33 @@ package model type EventSettings struct { - Id int - Name string - NumElimAlliances int - SelectionRound2Order string - SelectionRound3Order string - TBADownloadEnabled bool - TbaPublishingEnabled bool - TbaEventCode string - TbaSecretId string - TbaSecret string - NetworkSecurityEnabled bool - ApAddress string - ApUsername string - ApPassword string - ApTeamChannel int - ApAdminChannel int - ApAdminWpaKey string - SwitchAddress string - SwitchPassword string - PlcAddress string - AdminPassword string - ReaderPassword string - StemTvPublishingEnabled bool - StemTvEventCode string - ScaleLedAddress string - RedSwitchLedAddress string - BlueSwitchLedAddress string - RedVaultLedAddress string - BlueVaultLedAddress string + Id int + Name string + NumElimAlliances int + SelectionRound2Order string + SelectionRound3Order string + TBADownloadEnabled bool + TbaPublishingEnabled bool + TbaEventCode string + TbaSecretId string + TbaSecret string + NetworkSecurityEnabled bool + ApAddress string + ApUsername string + ApPassword string + ApTeamChannel int + ApAdminChannel int + ApAdminWpaKey string + SwitchAddress string + SwitchPassword string + PlcAddress string + AdminPassword string + ReaderPassword string + ScaleLedAddress string + RedSwitchLedAddress string + BlueSwitchLedAddress string + RedVaultLedAddress string + BlueVaultLedAddress string } const eventSettingsId = 0 diff --git a/partner/stemtv.go b/partner/stemtv.go deleted file mode 100644 index 6884f8d..0000000 --- a/partner/stemtv.go +++ /dev/null @@ -1,35 +0,0 @@ -// Copyright 2016 Team 254. All Rights Reserved. -// Author: pat@patfairbank.com (Patrick Fairbank) -// -// Methods for publishing match video split information to STEMtv. - -package partner - -import ( - "fmt" - "github.com/Team254/cheesy-arena/model" - "net/http" - "time" -) - -type StemTvClient struct { - BaseUrl string - eventCode string -} - -const ( - stemTvBaseUrl = "http://52.21.72.74:5000" - preMatchPaddingSec = 5 - postScoreDisplayPaddingSec = 10 -) - -func NewStemTvClient(eventCode string) *StemTvClient { - return &StemTvClient{stemTvBaseUrl, eventCode} -} - -func (client *StemTvClient) PublishMatchVideoSplit(match *model.Match, scoreDisplayTime time.Time) error { - url := fmt.Sprintf("%s/event/api/v1.0/%s/%s/split/%d,%d", client.BaseUrl, client.eventCode, match.TbaCode(), - match.StartedAt.Unix()-preMatchPaddingSec, scoreDisplayTime.Unix()+postScoreDisplayPaddingSec) - _, err := http.Get(url) - return err -} diff --git a/partner/stemtv_test.go b/partner/stemtv_test.go deleted file mode 100644 index f7e4320..0000000 --- a/partner/stemtv_test.go +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright 2016 Team 254. All Rights Reserved. -// Author: pat@patfairbank.com (Patrick Fairbank) - -package partner - -import ( - "github.com/Team254/cheesy-arena/model" - "github.com/stretchr/testify/assert" - "net/http" - "net/http/httptest" - "testing" - "time" -) - -func TestPublishMatchVideoSplit(t *testing.T) { - // Mock the STEMtv server. - stemTvServer := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - assert.Equal(t, "/event/api/v1.0/my_event_code/qm254/split/981187501,981187690", r.URL.String()) - })) - defer stemTvServer.Close() - - client := NewStemTvClient("my_event_code") - client.BaseUrl = stemTvServer.URL - - matchStartedTime, _ := time.Parse("2006-01-02 15:04:05 -0700", "2001-02-03 04:05:06 -0400") - match := &model.Match{Type: "qualification", DisplayName: "254", StartedAt: matchStartedTime} - scoreDisplayTime, _ := time.Parse("2006-01-02 15:04:05 -0700", "2001-02-03 04:08:00 -0400") - assert.Nil(t, client.PublishMatchVideoSplit(match, scoreDisplayTime)) -} diff --git a/templates/setup_settings.html b/templates/setup_settings.html index 918f4ec..46c4b0e 100644 --- a/templates/setup_settings.html +++ b/templates/setup_settings.html @@ -112,19 +112,6 @@ -
Contact STEMtv to obtain an event code.
-