2016-08-28 00:49:52 -07:00
|
|
|
// Copyright 2016 Team 254. All Rights Reserved.
|
|
|
|
|
// Author: pat@patfairbank.com (Patrick Fairbank)
|
|
|
|
|
//
|
|
|
|
|
// Methods for publishing match video split information to STEMtv.
|
|
|
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
2017-08-23 22:41:56 -07:00
|
|
|
"github.com/Team254/cheesy-arena/model"
|
2016-08-28 00:49:52 -07:00
|
|
|
"net/http"
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
const (
|
|
|
|
|
preMatchPaddingSec = 5
|
|
|
|
|
postScoreDisplayPaddingSec = 10
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
var stemTvBaseUrl = "http://stemtv.io"
|
|
|
|
|
|
2017-08-23 22:41:56 -07:00
|
|
|
func PublishMatchVideoSplit(match *model.Match, scoreDisplayTime time.Time) error {
|
2016-08-28 00:49:52 -07:00
|
|
|
url := fmt.Sprintf("%s/event/api/v1.0/%s/%s/split/%d,%d", stemTvBaseUrl, eventSettings.StemTvEventCode,
|
|
|
|
|
match.TbaCode(), match.StartedAt.Unix()-preMatchPaddingSec,
|
|
|
|
|
scoreDisplayTime.Unix()+postScoreDisplayPaddingSec)
|
|
|
|
|
_, err := http.Get(url)
|
|
|
|
|
return err
|
|
|
|
|
}
|