Documentation
¶
Overview ¶
Package gamelistxml implements a scraper that reads EmulationStation gamelist.xml files to enrich the Zaparoo MediaDB with developer, publisher, genre, rating, year, artwork paths, and descriptions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewPlatformScraper ¶
NewPlatformScraper returns a platforms.Scraper backed by EmulationStation gamelist.xml files. Systems are resolved at scrape time from the platform and media database; no state is captured at construction.
Types ¶
type GamelistRecord ¶
type GamelistRecord struct {
AvailableMediaDirs map[string]string
SystemRootPath string
Game esapi.Game
MatchedMediaDBID int64
MatchedTitleDBID int64
}
GamelistRecord is one matched gamelist.xml entry, bundled with the filesystem root path and the DB identifiers of the matched MediaTitle and one of its Media rows (used as the sentinel write target).
type GamelistXMLScraper ¶
type GamelistXMLScraper struct {
// contains filtered or unexported fields
}
GamelistXMLScraper loads and maps EmulationStation gamelist.xml records. Use NewPlatformScraper to obtain a configured platforms.Scraper.
func (*GamelistXMLScraper) LoadRecords ¶
func (g *GamelistXMLScraper) LoadRecords( ctx context.Context, system scraper.ScrapeSystem, titlesBySlug map[string]database.MediaTitle, mediaByTitleDBID map[int64]int64, ) ([]*GamelistRecord, error)
LoadRecords iterates gamelist.xml files found under each ROM root path for the given system. For each game entry whose slug matches a key in titlesBySlug, a GamelistRecord is emitted and the slug is removed from titlesBySlug (first match wins across all gamelists for the system). titlesBySlug is mutated by this call — callers must not reuse it.
mediaByTitleDBID supplies the Media DBID to use as the sentinel write target: it must map each MediaTitle DBID to any one of its associated Media DBIDs. A record whose title DBID has no entry in mediaByTitleDBID will have MatchedMediaDBID = 0 and will be skipped by the scrape loop.
func (*GamelistXMLScraper) MapToDB ¶
func (g *GamelistXMLScraper) MapToDB(record *GamelistRecord) scraper.MapResult
MapToDB converts a GamelistRecord into the tag and property writes to apply to the matched MediaTitle row. Media-level tags are not written by this scraper; only title-level tags and properties are populated.