track

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 15, 2019 License: GPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(delta int)

Add a task

func AddTarget

func AddTarget(ctx context.Context, link string) error

AddTarget for tracking

func CancelTarget

func CancelTarget(link string) error

CancelTarget processing

func CheckNow

func CheckNow()

CheckNow makes poll process right now

func Done

func Done()

Done removes a task

func RegisterModule

func RegisterModule(m Module) error

RegisterModule with a hostname note: we do not expect to be called after tracking begins

func RemoveTarget

func RemoveTarget(ctx context.Context, link string) error

RemoveTarget from tracking

func SnipeTargetAt

func SnipeTargetAt(ctx context.Context, t Target, at time.Time) error

SnipeTargetAt snipes a target at the given time

func Start

func Start(ctx context.Context) error

Start tracking

func Wait

func Wait()

Wait for tracking tasks to finish

Types

type DisplayRow

type DisplayRow struct {
	Status string
	Name   string
	Link   string
}

DisplayRow of data

type DisplayTable

type DisplayTable struct {
	Live     []DisplayRow
	Upcoming []DisplayRow
	Offline  []DisplayRow
}

DisplayTable tracking data

func Display

func Display() (d DisplayTable)

Display gives everyone we are tracking sorted by urgency for display by dashboard

func (DisplayTable) Output

func (d DisplayTable) Output(dst io.Writer) error

Output for ui

type Module

type Module interface {
	// information
	Hostname() string
	// called by track.poll with a list of targets to check
	CheckUpcoming(context.Context, []Target) error
	// called by track.AddTarget
	// give the target we added or nil
	// used to gather target information needed for tracking
	AddTarget(ctx context.Context, link string) (Target, error)
}

Module is called by poll and add/remove target

func FindModule

func FindModule(hostname string) (m Module, err error)

FindModule with hostname

type Target

type Target interface {
	// real name of streamer
	Name() string
	// for display in dashboard
	Display() string
	// url string
	Link() string

	// save path
	SavePath() string

	// check for live status
	CheckLive(context.Context) (bool, error)
	// check for a live stream
	CheckStream(context.Context) (string, error)

	// callback when sniping starts
	BeginSnipe(context.Context)
	// callback when save starts
	BeginSave(context.Context)
	// callback when save ends
	EndSave(context.Context)
	// callback when user requests reload
	Reload(context.Context)
}

Target is being tracked for stream activity

Jump to

Keyboard shortcuts

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