mirror of
https://github.com/Team254/cheesy-arena-lite.git
synced 2026-03-09 13:46:44 -04:00
Remove STEMtv client since the service has been discontinued.
This commit is contained in:
@@ -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
|
||||
}
|
||||
@@ -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))
|
||||
}
|
||||
Reference in New Issue
Block a user