sportboard

package
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 19, 2023 License: GPL-3.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API interface {
	GetTeams(ctx context.Context) ([]Team, error)
	TeamFromID(ctx context.Context, abbreviation string) (Team, error)
	GetScheduledGames(ctx context.Context, date []time.Time) ([]Game, error)
	DateStr(d time.Time) string
	League() string
	HTTPPathPrefix() string
	// AllTeamAbbreviations() []string
	GetWatchTeams(teams []string, season string) []string
	TeamRecord(ctx context.Context, team Team, season string) string
	TeamRank(ctx context.Context, team Team, season string) string
	CacheClear(ctx context.Context)
	HomeSideSwap() bool
}

API ...

type Config

type Config struct {
	TodayFunc Todayer

	TimeColor            color.Color
	ScoreColor           color.Color
	StartEnabled         *atomic.Bool      `json:"enabled"`
	BoardDelay           string            `json:"boardDelay"`
	FavoriteSticky       *atomic.Bool      `json:"favoriteSticky"`
	StickyDelay          string            `json:"stickyDelay"`
	ScoreFont            *FontConfig       `json:"scoreFont"`
	TimeFont             *FontConfig       `json:"timeFont"`
	LiveViewFont         *FontConfig       `json:"liveViewFont"`
	LogoConfigs          []*logo.Config    `json:"logoConfigs"`
	WatchTeams           []string          `json:"watchTeams"`
	FavoriteTeams        []string          `json:"favoriteTeams"`
	HideFavoriteScore    *atomic.Bool      `json:"hideFavoriteScore"`
	ShowRecord           *atomic.Bool      `json:"showRecord"`
	GridCols             int               `json:"gridCols"`
	GridRows             int               `json:"gridRows"`
	GridPadRatio         float64           `json:"gridPadRatio"`
	MinimumGridWidth     int               `json:"minimumGridWidth"`
	MinimumGridHeight    int               `json:"minimumGridHeight"`
	Stats                *statboard.Config `json:"stats"`
	Headlines            *textboard.Config `json:"headlines"`
	ScoreHighlightRepeat *int              `json:"scoreHighlightRepeat"`
	OnTimes              []string          `json:"onTimes"`
	OffTimes             []string          `json:"offTimes"`
	UseGradient          *atomic.Bool      `json:"useGradient"`
	LiveOnly             *atomic.Bool      `json:"liveOnly"`
	Enable24Hour         *atomic.Bool      `json:"enable24Hour"`
	AdvanceDays          int               `json:"advanceDays"`
	PreviousDays         int               `json:"previousDays"`
	// contains filtered or unexported fields
}

Config ...

func (*Config) SetDefaults

func (c *Config) SetDefaults()

SetDefaults sets config defaults

type DetailedLiveRender

type DetailedLiveRender func(ctx context.Context, canvas board.Canvas, game Game, homeLogo *logo.Logo, awayLogo *logo.Logo) error

type FontConfig

type FontConfig struct {
	Size      float64 `json:"size"`
	LineSpace float64 `json:"lineSpace"`
}

FontConfig ...

type Game

type Game interface {
	GetID() int
	GetLink() (string, error)
	IsLive() (bool, error)
	IsComplete() (bool, error)
	IsPostponed() (bool, error)
	HomeTeam() (Team, error)
	AwayTeam() (Team, error)
	GetQuarter() (string, error) // Or a period, inning
	GetClock() (string, error)
	GetUpdate(ctx context.Context) (Game, error)
	GetStartTime(ctx context.Context) (time.Time, error)
	GetOdds() (string, string, error)
}

Game ...

type OptionFunc

type OptionFunc func(s *SportBoard) error

func WithDetailedLiveRenderer

func WithDetailedLiveRenderer(d DetailedLiveRender) OptionFunc

func WithLeagueLogoGetter added in v0.0.88

func WithLeagueLogoGetter(g logo.SourceGetter) OptionFunc

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server ...

func (*Server) GetStatus

func (s *Server) GetStatus(ctx context.Context, req *emptypb.Empty) (*pb.StatusResp, error)

GetStatus ...

func (*Server) SetStatus

func (s *Server) SetStatus(ctx context.Context, req *pb.SetStatusReq) (*emptypb.Empty, error)

SetStatus ...

type SportBoard

type SportBoard struct {
	sync.Mutex
	// contains filtered or unexported fields
}

SportBoard implements board.Board

func New

func New(ctx context.Context, api API, bounds image.Rectangle, today *time.Time, logger *zap.Logger, config *Config, opts ...OptionFunc) (*SportBoard, error)

New ...

func (*SportBoard) Enabler

func (s *SportBoard) Enabler() board.Enabler

func (*SportBoard) GetHTTPHandlers

func (s *SportBoard) GetHTTPHandlers() ([]*board.HTTPHandler, error)

GetHTTPHandlers ...

func (*SportBoard) GetRPCHandler

func (s *SportBoard) GetRPCHandler() (string, http.Handler)

GetRPCHandler ...

func (*SportBoard) GridSize

func (s *SportBoard) GridSize(bounds image.Rectangle) (int, int)

GridSize returns the column width and row height for a grid layout. 0 is returned for both if the canvas is too small for a grid.

func (*SportBoard) HasPriority

func (s *SportBoard) HasPriority() bool

HasPriority ...

func (*SportBoard) InBetween

func (s *SportBoard) InBetween() bool

InBetween ...

func (*SportBoard) Name

func (s *SportBoard) Name() string

Name ...

func (*SportBoard) Render

func (s *SportBoard) Render(ctx context.Context, canvas board.Canvas) error

Render ...

func (*SportBoard) RenderGameCounter

func (s *SportBoard) RenderGameCounter(canvas board.Canvas, numGames int, activeIndex int) (image.Image, error)

RenderGameCounter ...

func (s *SportBoard) RenderLeftLogo(ctx context.Context, canvasBounds image.Rectangle, teamID string) (image.Image, error)

RenderLeftLogo ...

func (s *SportBoard) RenderRightLogo(ctx context.Context, canvasBounds image.Rectangle, teamID string) (image.Image, error)

RenderRightLogo ...

func (*SportBoard) ScrollMode

func (s *SportBoard) ScrollMode() bool

ScrollMode ...

func (*SportBoard) SetLiveOnly

func (s *SportBoard) SetLiveOnly(live bool)

SetLiveOnly sets this board to show only live games or not

type Team

type Team interface {
	GetID() string
	GetName() string
	GetAbbreviation() string
	GetDisplayName() string
	Score() int
	ConferenceName() string
}

Team ...

type Todayer

type Todayer func() []time.Time

Todayer is a func that returns a string representing a date that will be used for determining "Today's" games. This is useful in testing what past days looked like

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL