tracker

package
v0.0.0-...-6f6a9a1 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: GPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	EventActionCoreStart = iota
	EventActionCoreStop
	EventActionGameStart
	EventActionGameStop
	EventActionMenuNavigation
)
View Source
const ArcadeSystem = "Arcade"

Variables

This section is empty.

Functions

func StartFileWatch

func StartFileWatch(tr *Tracker) (*fsnotify.Watcher, error)

StartFileWatch Start thread for monitoring changes to all files relating to core/game launches.

Types

type CoreTime

type CoreTime struct {
	Name string
	Time int
}

type Db

type Db interface {
	FixPowerLoss() (bool, error)
	AddEvent(ev EventAction) error
	UpdateCore(ct CoreTime) error
	GetCore(name string) (CoreTime, error)
	UpdateGame(gt GameTime) error
	GetGame(id string) (GameTime, error)
	NoResults(err error) bool
}

type EventAction

type EventAction struct {
	Timestamp  time.Time
	Action     int
	Target     string
	TargetPath string
	TotalTime  int // for recovery from power loss
	ActiveCore struct {
		Core       string
		System     string
		SystemName string
	}
	ActiveGame struct {
		Path string
		Name string
	}
}

type GameTime

type GameTime struct {
	Id     string
	Path   string
	Name   string
	Folder string
	Time   int
}

type NameMapping

type NameMapping struct {
	CoreName   string
	System     string
	Name       string // TODO: use names.txt
	ArcadeName string
}

type Tracker

type Tracker struct {
	Logger *service.Logger
	Config *config.UserConfig
	Db     Db

	ActiveCore       string
	ActiveSystem     string
	ActiveSystemName string
	ActiveGame       string
	ActiveGameName   string
	ActiveGamePath   string
	Events           []EventAction
	CoreTimes        map[string]CoreTime
	GameTimes        map[string]GameTime
	NameMap          []NameMapping
	// contains filtered or unexported fields
}

func NewTracker

func NewTracker(logger *service.Logger, cfg *config.UserConfig, db Db) (*Tracker, error)

func (*Tracker) LoadCore

func (tr *Tracker) LoadCore()

LoadCore loads the current running core and set it as active.

func (*Tracker) LookupName

func (tr *Tracker) LookupName(name string, game string) NameMapping

func (*Tracker) ReloadNameMap

func (tr *Tracker) ReloadNameMap()

func (*Tracker) StartTicker

func (tr *Tracker) StartTicker(saveInterval int)

StartTicker starts the thread for updating core/game play times.

func (*Tracker) StopAll

func (tr *Tracker) StopAll()

Jump to

Keyboard shortcuts

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