games

package
v3.0.5 Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateRoomID

func GenerateRoomID(gameName string) string

GenerateRoomID generate a unique room ID containing 16 digits.

func GetGameNameFromRoomID

func GetGameNameFromRoomID(roomID string) string

GetGameNameFromRoomID parse roomID to get roomID and gameName.

Types

type AppMeta

type AppMeta struct {
	Name string
	Type string
	Base string
	Path string
}

type Config

type Config struct {
	// some directory which is going to be
	// the root folder for the library
	BasePath string
	// a list of supported file extensions
	Supported []string
	// a list of ignored words in the files
	Ignored []string
	// print some additional info
	Verbose bool
	// enable directory changes watch
	WatchMode bool
}

Config is an external configuration

func (Config) GetSupportedExtensions

func (c Config) GetSupportedExtensions() []string

type FileExtensionWhitelist

type FileExtensionWhitelist interface {
	GetSupportedExtensions() []string
}

type GameLauncher

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

func NewGameLauncher

func NewGameLauncher(lib GameLibrary) GameLauncher

func (GameLauncher) ExtractAppNameFromUrl

func (gl GameLauncher) ExtractAppNameFromUrl(name string) string

func (GameLauncher) FindAppByName

func (gl GameLauncher) FindAppByName(name string) (AppMeta, error)

func (GameLauncher) GetAppNames

func (gl GameLauncher) GetAppNames() []string

type GameLibrary

type GameLibrary interface {
	GetAll() []GameMetadata
	FindGameByName(name string) GameMetadata
	Scan()
}

func NewLib

func NewLib(conf Config, log *logger.Logger) GameLibrary

func NewLibWhitelisted

func NewLibWhitelisted(conf Config, filter FileExtensionWhitelist, log *logger.Logger) GameLibrary

type GameMetadata

type GameMetadata struct {

	// the display name of the game
	Name string
	// the game file extension (e.g. nes, n64)
	Type string
	Base string
	// the game path relative to the library base path
	Path string
	// contains filtered or unexported fields
}

func (GameMetadata) FullPath

func (g GameMetadata) FullPath() string

type Launcher

type Launcher interface {
	FindAppByName(name string) (AppMeta, error)
	ExtractAppNameFromUrl(name string) string
	GetAppNames() []string
}

Jump to

Keyboard shortcuts

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