ds

package
v1.2.6 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2017 License: MIT Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrImgNotFound = errors.New("image not found")

ErrImgNotFound is the error returned when a rom image can't be found.

View Source
var ErrNotFound = errors.New("hash not found")

ErrNotFound is the error returned when a rom can't be found in the source.

Functions

func DefaultCachePath

func DefaultCachePath() (string, error)

DefaultCachePath returns the path used for all cached data. Current <HOME>/.sselph-scraper or <HOMEDIR>\Application Data\sselph-scraper

Types

type ADB added in v1.2.6

type ADB struct{}

ADB is a Data Source using arcadeitalia and arcade-history.

func (*ADB) GetGame added in v1.2.6

func (a *ADB) GetGame(p string) (*Game, error)

GetGame implements DS.

func (*ADB) GetName added in v1.2.6

func (a *ADB) GetName(p string) string

GetName implements DS.

type DS

type DS interface {
	// GetName takes the path of a ROM and returns the Pretty name if it differs from the Sources normal name.
	GetName(string) string
	// GetGame takes an id and returns the Game.
	GetGame(string) (*Game, error)
}

DS is the interface all DataSoures should implement.

type Daphne added in v1.1.3

type Daphne struct {
	HM *HashMap
}

Daphne is a data source using GDB for Daphne games.

func (*Daphne) GetGame added in v1.1.3

func (d *Daphne) GetGame(p string) (*Game, error)

GetGame implements DS.

func (*Daphne) GetName added in v1.1.3

func (d *Daphne) GetName(p string) string

GetName implements DS.

type GDB

type GDB struct {
	HM     *HashMap
	Hasher *Hasher
}

GDB is a DataSource using thegamesdb.net

func (*GDB) GetGame

func (g *GDB) GetGame(p string) (*Game, error)

GetGame implements DS

func (*GDB) GetName

func (g *GDB) GetName(p string) string

GetName implements DS

func (*GDB) Hash added in v1.0.5

func (g *GDB) Hash(p string) (string, error)

Hash hashes a ROM.

type Game

type Game struct {
	ID          string
	Source      string
	GameTitle   string
	Overview    string
	Images      map[ImgType]Image
	Thumbs      map[ImgType]Image
	Rating      float64
	ReleaseDate string
	Developer   string
	Publisher   string
	Genre       string
	Players     int64
}

Game is the standard Game that all sources will return. They don't have to populate all values.

func NewGame

func NewGame() *Game

NewGame returns a new Game.

func ParseGDBGame added in v1.1.4

func ParseGDBGame(game gdb.Game, imgURL string) *Game

ParseGDBGame parses a gdb.Game and returns a Game.

type HTTPImage added in v1.2.1

type HTTPImage struct {
	URL string
}

func (HTTPImage) Get added in v1.2.1

func (i HTTPImage) Get(w, h uint) (image.Image, error)

func (HTTPImage) Save added in v1.2.1

func (i HTTPImage) Save(p string, w, h uint) error

type HTTPImageSS added in v1.2.1

type HTTPImageSS struct {
	URL   string
	Limit chan struct{}
}

func (HTTPImageSS) Get added in v1.2.1

func (i HTTPImageSS) Get(width, height uint) (image.Image, error)

func (HTTPImageSS) Save added in v1.2.1

func (i HTTPImageSS) Save(p string, width, height uint) error

type HashMap

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

HashMap a mapping of hash to names and GDB IDs.

func CachedHashMap

func CachedHashMap(p string, u bool) (*HashMap, error)

CachedHashMap gets the mapping of hashes to IDs.

func FileHashMap

func FileHashMap(p string) (*HashMap, error)

FileHashMap creates a hash map from a csv file.

func (*HashMap) ID added in v1.1.9

func (hm *HashMap) ID(s string) (string, bool)

GetID returns the id for the given hash.

func (*HashMap) Name added in v1.1.9

func (hm *HashMap) Name(s string) (string, bool)

GetName returns the no-intro name for the given hash.

func (*HashMap) System added in v1.1.9

func (hm *HashMap) System(s string) (int, bool)

type Hasher

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

Hasher is a thread-safe object to hash files. Hashes are cached and multiple calls to hash the same file wait for the first call to complete to read from cache.

func NewHasher

func NewHasher(hashFunc func() hash.Hash, threads int) (*Hasher, error)

NewHasher creates a new Hasher that hashes using the provided hash. threads is the expected number of threads a 4MB buffer will be created for each.

func (*Hasher) Hash

func (h *Hasher) Hash(p string) (string, error)

Hash returns the hash of the file at the given path.

type Image added in v1.2.1

type Image interface {
	Get(w, h uint) (image.Image, error)
	Save(p string, w, h uint) error
}

type ImgType

type ImgType string

ImgType represents the different image types that sources may provide.

const (
	ImgBoxart   ImgType = "b"
	ImgBoxart3D ImgType = "3b"
	ImgScreen   ImgType = "s"
	ImgFanart   ImgType = "f"
	ImgBanner   ImgType = "a"
	ImgTitle    ImgType = "t"
	ImgMarquee  ImgType = "m"
	ImgCabinet  ImgType = "c"
	ImgFlyer    ImgType = "fly"
)

Image types for Datasource options. Not all types are valid for all sources.

type MAME

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

MAME is a Data Source using mamedb and arcade-history.

func NewMAME

func NewMAME(p string, u bool) (*MAME, error)

NewMAME returns a new MAME. MAME should be closed when not needed.

func (*MAME) Close

func (m *MAME) Close() error

Close implements io.Closer.

func (*MAME) GetGame

func (m *MAME) GetGame(p string) (*Game, error)

GetGame implements DS.

func (*MAME) GetName

func (m *MAME) GetName(p string) string

GetName implements DS.

type NeoGeo added in v1.1.4

type NeoGeo struct {
	HM *HashMap
}

NeoGeo is a data source using GDB for Daphne games.

func (*NeoGeo) GetGame added in v1.1.4

func (n *NeoGeo) GetGame(p string) (*Game, error)

GetGame implements DS.

func (*NeoGeo) GetName added in v1.1.4

func (n *NeoGeo) GetName(p string) string

GetName implements DS.

type OVGDB

type OVGDB struct {
	Hasher *Hasher
	// contains filtered or unexported fields
}

OVGDB is a DataSource using OpenVGDB.

func NewOVGDB

func NewOVGDB(h *Hasher, u bool) (*OVGDB, error)

NewOVGDB returns a new OVGDB. OVGDB should be closed when not needed.

func (*OVGDB) Close

func (o *OVGDB) Close() error

Close closes the DB.

func (*OVGDB) GetGame

func (o *OVGDB) GetGame(p string) (*Game, error)

GetGame implements DS.

func (*OVGDB) GetName

func (o *OVGDB) GetName(p string) string

GetName implements DS.

type SS added in v1.1.9

type SS struct {
	HM     *HashMap
	Hasher *Hasher
	Dev    ss.DevInfo
	User   ss.UserInfo
	Lang   []string
	Region []string
	Width  int
	Height int
	Limit  chan struct{}
}

SS is the source for ScreenScraper

func (*SS) GetGame added in v1.1.9

func (s *SS) GetGame(path string) (*Game, error)

GetGame implements DS

func (*SS) GetName added in v1.1.9

func (s *SS) GetName(p string) string

GetName implements DS

type SSMAME added in v1.2.0

type SSMAME struct {
	Dev    ss.DevInfo
	User   ss.UserInfo
	Lang   []string
	Region []string
	Width  int
	Height int
	Limit  chan struct{}
}

SSMAME is the source for ScreenScraper

func (*SSMAME) GetGame added in v1.2.0

func (s *SSMAME) GetGame(path string) (*Game, error)

GetGame implements DS

func (*SSMAME) GetName added in v1.2.0

func (s *SSMAME) GetName(p string) string

GetName implements DS

type ScummVM

type ScummVM struct {
	HM *HashMap
}

ScummVM is a data source using GDB for ScummVM games.

func (*ScummVM) GetGame

func (s *ScummVM) GetGame(p string) (*Game, error)

GetGame implements DS.

func (*ScummVM) GetName

func (s *ScummVM) GetName(p string) string

GetName implements DS.

Jump to

Keyboard shortcuts

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