identify

package
v1.10.0 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2026 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Overview

Package identify works out which game a scanned folder is: its proper title and Steam or GOG id, from the ids a copy carries or, failing that, its name, using the community Ludusavi manifest (PCGamingWiki data on ~50,000 games, with their Steam and GOG ids and install folder names).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Entry

type Entry struct {
	Name        string
	SteamID     int
	GogID       string
	InstallDirs []string
	Aliases     []string // other names that point here
}

Entry is one game in the manifest.

func Parse

func Parse(r io.Reader) ([]Entry, error)

Parse reads the manifest YAML (see gamekit/ludusavi).

type Index

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

Index answers lookups by id, title and install folder name.

func (*Index) Identify

func (ix *Index) Identify(c scan.Candidate) Match

Identify establishes the game behind a candidate. ix may be nil (no manifest yet): the candidate's own ids and title are used as they are.

func (*Index) Len

func (ix *Index) Len() int

Len is the number of titles the index knows.

func (*Index) SteamName

func (ix *Index) SteamName(id int) string

SteamName returns the manifest's title for a Steam app id.

type Manager

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

Manager loads the manifest index from cache and refreshes it weekly. Only scans use the index (~15 MB in memory), so it's let go a couple of minutes after the last use and read again (~50 ms) by the next scan.

func NewManager

func NewManager(dir string) *Manager

NewManager uses dir for the cached index (created on demand).

func (*Manager) Index

func (m *Manager) Index() *Index

Index returns the loaded index, reading the cache on first use; nil until one exists.

func (*Manager) Len

func (m *Manager) Len() int

Len is the number of titles in the game database (0 before it exists), without loading it.

func (*Manager) Refresh

func (m *Manager) Refresh(ctx context.Context) (bool, error)

Refresh downloads the manifest when it changed and rebuilds the index. It reports whether a new index was built.

func (*Manager) Stale

func (m *Manager) Stale() bool

Stale reports whether the cached index is missing or older than a week.

type Match

type Match struct {
	Title      string
	SteamAppID int
	GogID      string
	Confidence int    // 0–100
	How        string // how the identity was established
}

Match is who a scanned game turned out to be.

Jump to

Keyboard shortcuts

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