sportboard

package
v0.0.50 Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2021 License: GPL-3.0 Imports: 19 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)
	TeamFromAbbreviation(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)
}

API ...

type Config

type Config struct {
	TodayFunc Todayer

	TimeColor            color.Color
	ScoreColor           color.Color
	Enabled              *atomic.Bool      `json:"enabled"`
	BoardDelay           string            `json:"boardDelay"`
	FavoriteSticky       *atomic.Bool      `json:"favoriteSticky"`
	ScoreFont            *FontConfig       `json:"scoreFont"`
	TimeFont             *FontConfig       `json:"timeFont"`
	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"`
	ScrollMode           *atomic.Bool      `json:"scrollMode"`
	TightScroll          *atomic.Bool      `json:"tightScroll"`
	TightScrollPadding   int               `json:"tightScrollPadding"`
	ScrollDelay          string            `json:"scrollDelay"`
	GamblingSpread       *atomic.Bool      `json:"showOdds"`
	ScoreHighlightRepeat *int              `json:"scoreHighlightRepeat"`
	// contains filtered or unexported fields
}

Config ...

func (*Config) SetDefaults

func (c *Config) SetDefaults()

SetDefaults sets config defaults

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 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, logger *zap.Logger, config *Config) (*SportBoard, error)

New ...

func (*SportBoard) Disable added in v0.0.8

func (s *SportBoard) Disable()

Disable ...

func (*SportBoard) Enable added in v0.0.8

func (s *SportBoard) Enable()

Enable ...

func (*SportBoard) Enabled

func (s *SportBoard) Enabled() bool

Enabled ...

func (*SportBoard) GetHTTPHandlers

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

GetHTTPHandlers ...

func (*SportBoard) GridSize added in v0.0.14

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) 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, abbreviation string) (image.Image, error)

RenderLeftLogo ...

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

RenderRightLogo ...

func (*SportBoard) ScrollMode added in v0.0.29

func (s *SportBoard) ScrollMode() bool

ScrollMode ...

type Team

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

Team ...

type Todayer added in v0.0.7

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