Documentation
¶
Index ¶
- Variables
- func GetSystemDefsByID() map[string]systemdefs.System
- func GetTestSystemDefs() []systemdefs.System
- func NewAPIToken() *tokens.Token
- func NewAmiiboToken() *tokens.Token
- func NewArcadeGame() *models.ActiveMedia
- func NewConsoleGame() *models.ActiveMedia
- func NewCustomMedia(launcherID, systemID, systemName, path, name string) *models.ActiveMedia
- func NewCustomToken(tokenType, uid, text, source string, fromAPI, unsafe bool) *tokens.Token
- func NewEmptyPlaylist() *playlists.Playlist
- func NewEmptyToken() *tokens.Token
- func NewHandheldGame() *models.ActiveMedia
- func NewHistoryEntry(tokenType, tokenID, tokenValue string, success bool) database.HistoryEntry
- func NewMapping(label, matchType, pattern string, enabled bool) database.Mapping
- func NewMifareToken() *tokens.Token
- func NewModernGame() *models.ActiveMedia
- func NewNFCToken() *tokens.Token
- func NewRetroGame() *models.ActiveMedia
- func NewRetroPlaylist() *playlists.Playlist
- func NewSamplePlaylist() *playlists.Playlist
- func NewSystem(systemID, name string) database.System
- func NewUnsafeToken() *tokens.Token
- func SampleMedia() []*models.ActiveMedia
- func SamplePlaylists() []*playlists.Playlist
- func SampleTokens() []*tokens.Token
- type MediaCollection
- func (mc *MediaCollection) AllMedia() []*models.ActiveMedia
- func (mc *MediaCollection) LauncherIDs() []string
- func (mc *MediaCollection) MediaByLauncherID(launcherID string) *models.ActiveMedia
- func (mc *MediaCollection) MediaBySystemID(systemID string) *models.ActiveMedia
- func (mc *MediaCollection) RetroMedia() []*models.ActiveMedia
- func (mc *MediaCollection) SystemIDs() []string
- type TokenCollection
Constants ¶
This section is empty.
Variables ¶
var HistoryEntries = struct { Collection []database.HistoryEntry Successful database.HistoryEntry Failed database.HistoryEntry APIToken database.HistoryEntry HardwareToken database.HistoryEntry }{ Successful: database.HistoryEntry{ Time: time.Date(2025, 1, 15, 12, 0, 0, 0, time.UTC), Type: "ntag213", TokenID: "04:12:34:AB:CD:EF:80", TokenValue: "zelda:botw", TokenData: "", DBID: 1, Success: true, }, Failed: database.HistoryEntry{ Time: time.Date(2025, 1, 15, 12, 5, 0, 0, time.UTC), Type: "ntag213", TokenID: "04:56:78:AB:CD:EF:80", TokenValue: "unknown:game", TokenData: "", DBID: 2, Success: false, }, APIToken: database.HistoryEntry{ Time: time.Date(2025, 1, 15, 12, 10, 0, 0, time.UTC), Type: "api", TokenID: "api-request-123", TokenValue: "mario:smw", TokenData: `{"source":"web_ui","user_id":"test"}`, DBID: 3, Success: true, }, HardwareToken: database.HistoryEntry{ Time: time.Date(2025, 1, 15, 12, 15, 0, 0, time.UTC), Type: "mifare_classic", TokenID: "AB:CD:EF:12:34:56:78", TokenValue: "sega:sonic", TokenData: "sector_0_data", DBID: 4, Success: true, }, Collection: []database.HistoryEntry{ { Time: time.Date(2025, 1, 15, 12, 0, 0, 0, time.UTC), Type: "ntag213", TokenID: "04:12:34:AB:CD:EF:80", TokenValue: "zelda:botw", TokenData: "", DBID: 1, Success: true, }, { Time: time.Date(2025, 1, 15, 12, 5, 0, 0, time.UTC), Type: "ntag213", TokenID: "04:56:78:AB:CD:EF:80", TokenValue: "unknown:game", TokenData: "", DBID: 2, Success: false, }, { Time: time.Date(2025, 1, 15, 12, 10, 0, 0, time.UTC), Type: "api", TokenID: "api-request-123", TokenValue: "mario:smw", TokenData: `{"source":"web_ui","user_id":"test"}`, DBID: 3, Success: true, }, }, }
HistoryEntries provides sample history entries for testing
var Mappings = struct { Collection []database.Mapping SimplePattern database.Mapping RegexPattern database.Mapping SystemMapping database.Mapping DisabledMapping database.Mapping }{ SimplePattern: database.Mapping{ Label: "Zelda Collection", Type: "text", Match: "exact", Pattern: "zelda:*", Override: "", DBID: 1, Added: time.Now().Unix(), Enabled: true, }, RegexPattern: database.Mapping{ Label: "Mario Games", Type: "text", Match: "regex", Pattern: "mario:.*", Override: "", DBID: 2, Added: time.Now().Unix(), Enabled: true, }, SystemMapping: database.Mapping{ Label: "SNES System", Type: "system", Match: "exact", Pattern: "snes", Override: "Nintendo - Super Nintendo Entertainment System", DBID: 3, Added: time.Now().Unix(), Enabled: true, }, DisabledMapping: database.Mapping{ Label: "Disabled Mapping", Type: "text", Match: "exact", Pattern: "disabled:*", Override: "", DBID: 4, Added: time.Now().Unix(), Enabled: false, }, Collection: []database.Mapping{ { Label: "Zelda Collection", Type: "text", Match: "exact", Pattern: "zelda:*", Override: "", DBID: 1, Added: time.Now().Unix(), Enabled: true, }, { Label: "Mario Games", Type: "text", Match: "regex", Pattern: "mario:.*", Override: "", DBID: 2, Added: time.Now().Unix(), Enabled: true, }, { Label: "SNES System", Type: "system", Match: "exact", Pattern: "snes", Override: "Nintendo - Super Nintendo Entertainment System", DBID: 3, Added: time.Now().Unix(), Enabled: true, }, }, }
Mappings provides sample mapping data for testing
var Media = struct { Collection []database.Media PitfallROM database.Media TetrisROM database.Media SuperMetroidROM database.Media FFVIIISO database.Media }{ PitfallROM: database.Media{ Path: "/media/Atari - 2600/Pitfall! (1982).zip", DBID: 1, MediaTitleDBID: 1, }, TetrisROM: database.Media{ Path: "/media/Nintendo - Game Boy/Tetris (1989).gb", DBID: 2, MediaTitleDBID: 2, }, SuperMetroidROM: database.Media{ Path: "/media/Nintendo - Super Nintendo Entertainment System/Super Metroid (1994).sfc", DBID: 3, MediaTitleDBID: 3, }, FFVIIISO: database.Media{ Path: "/media/Sony - PlayStation/Final Fantasy VII (1997).chd", DBID: 4, MediaTitleDBID: 4, }, Collection: []database.Media{ {Path: "/media/Atari - 2600/Pitfall! (1982).zip", DBID: 1, MediaTitleDBID: 1}, {Path: "/media/Nintendo - Game Boy/Tetris (1989).gb", DBID: 2, MediaTitleDBID: 2}, { Path: "/media/Nintendo - Super Nintendo Entertainment System/Super Metroid (1994).sfc", DBID: 3, MediaTitleDBID: 3, }, {Path: "/media/Sony - PlayStation/Final Fantasy VII (1997).chd", DBID: 4, MediaTitleDBID: 4}, }, }
Media provides sample media file data
var MediaTags = struct { Collection []database.MediaTag PitfallAction database.MediaTag TetrisPuzzle database.MediaTag TetrisNintendo database.MediaTag }{ PitfallAction: database.MediaTag{ DBID: 1, MediaDBID: 1, TagDBID: 1, }, TetrisPuzzle: database.MediaTag{ DBID: 2, MediaDBID: 2, TagDBID: 2, }, TetrisNintendo: database.MediaTag{ DBID: 3, MediaDBID: 2, TagDBID: 3, }, Collection: []database.MediaTag{ {DBID: 1, MediaDBID: 1, TagDBID: 1}, {DBID: 2, MediaDBID: 2, TagDBID: 2}, {DBID: 3, MediaDBID: 2, TagDBID: 3}, }, }
MediaTags provides sample media-tag associations
var MediaTitles = struct { Collection []database.MediaTitle Pitfall database.MediaTitle Tetris database.MediaTitle SuperMetroid database.MediaTitle FFVII database.MediaTitle }{ Pitfall: database.MediaTitle{ Slug: "pitfall", Name: "Pitfall!", DBID: 1, SystemDBID: 1, }, Tetris: database.MediaTitle{ Slug: "tetris", Name: "Tetris", DBID: 2, SystemDBID: 2, }, SuperMetroid: database.MediaTitle{ Slug: "super-metroid", Name: "Super Metroid", DBID: 3, SystemDBID: 3, }, FFVII: database.MediaTitle{ Slug: "final-fantasy-vii", Name: "Final Fantasy VII", DBID: 4, SystemDBID: 4, }, Collection: []database.MediaTitle{ {Slug: "pitfall", Name: "Pitfall!", DBID: 1, SystemDBID: 1}, {Slug: "tetris", Name: "Tetris", DBID: 2, SystemDBID: 2}, {Slug: "super-metroid", Name: "Super Metroid", DBID: 3, SystemDBID: 3}, {Slug: "final-fantasy-vii", Name: "Final Fantasy VII", DBID: 4, SystemDBID: 4}, }, }
MediaTitles provides sample media title data
var SearchResults = struct { PitfallResult database.SearchResult TetrisResult database.SearchResult SuperMetroidResult database.SearchResult Collection []database.SearchResult }{ PitfallResult: database.SearchResult{ SystemID: "atari2600", Name: "Pitfall!", Path: "/media/Atari - 2600/Pitfall! (1982).zip", }, TetrisResult: database.SearchResult{ SystemID: "gb", Name: "Tetris", Path: "/media/Nintendo - Game Boy/Tetris (1989).gb", }, SuperMetroidResult: database.SearchResult{ SystemID: "snes", Name: "Super Metroid", Path: "/media/Nintendo - Super Nintendo Entertainment System/Super Metroid (1994).sfc", }, Collection: []database.SearchResult{ {SystemID: "atari2600", Name: "Pitfall!", Path: "/media/Atari - 2600/Pitfall! (1982).zip"}, {SystemID: "gb", Name: "Tetris", Path: "/media/Nintendo - Game Boy/Tetris (1989).gb"}, { SystemID: "snes", Name: "Super Metroid", Path: "/media/Nintendo - Super Nintendo Entertainment System/Super Metroid (1994).sfc", }, }, }
SearchResults provides sample search result data
var Systems = struct { Atari2600 database.System GameBoy database.System SNES database.System PlayStation database.System Collection []database.System }{ Atari2600: database.System{ SystemID: "atari2600", Name: "Atari - 2600", DBID: 1, }, GameBoy: database.System{ SystemID: "gb", Name: "Nintendo - Game Boy", DBID: 2, }, SNES: database.System{ SystemID: "snes", Name: "Nintendo - Super Nintendo Entertainment System", DBID: 3, }, PlayStation: database.System{ SystemID: "psx", Name: "Sony - PlayStation", DBID: 4, }, Collection: []database.System{ {SystemID: "atari2600", Name: "Atari - 2600", DBID: 1}, {SystemID: "gb", Name: "Nintendo - Game Boy", DBID: 2}, {SystemID: "snes", Name: "Nintendo - Super Nintendo Entertainment System", DBID: 3}, {SystemID: "psx", Name: "Sony - PlayStation", DBID: 4}, }, }
Systems provides sample system data for MediaDB testing
var TagTypes = struct { Genre database.TagType Developer database.TagType Year database.TagType Collection []database.TagType }{ Genre: database.TagType{ Type: "genre", DBID: 1, }, Developer: database.TagType{ Type: "developer", DBID: 2, }, Year: database.TagType{ Type: "year", DBID: 3, }, Collection: []database.TagType{ {Type: "genre", DBID: 1}, {Type: "developer", DBID: 2}, {Type: "year", DBID: 3}, }, }
TagTypes provides sample tag type data
var Tags = struct { Collection []database.Tag ActionGenre database.Tag PuzzleGenre database.Tag Nintendo database.Tag SquareEnix database.Tag Year1982 database.Tag Year1989 database.Tag }{ ActionGenre: database.Tag{ Tag: "Action", DBID: 1, TypeDBID: 1, }, PuzzleGenre: database.Tag{ Tag: "Puzzle", DBID: 2, TypeDBID: 1, }, Nintendo: database.Tag{ Tag: "Nintendo", DBID: 3, TypeDBID: 2, }, SquareEnix: database.Tag{ Tag: "Square Enix", DBID: 4, TypeDBID: 2, }, Year1982: database.Tag{ Tag: "1982", DBID: 5, TypeDBID: 3, }, Year1989: database.Tag{ Tag: "1989", DBID: 6, TypeDBID: 3, }, Collection: []database.Tag{ {Tag: "Action", DBID: 1, TypeDBID: 1}, {Tag: "Puzzle", DBID: 2, TypeDBID: 1}, {Tag: "Nintendo", DBID: 3, TypeDBID: 2}, {Tag: "Square Enix", DBID: 4, TypeDBID: 2}, {Tag: "1982", DBID: 5, TypeDBID: 3}, {Tag: "1989", DBID: 6, TypeDBID: 3}, }, }
Tags provides sample tag data
var TestActivePlayers = []kodi.Player{
{Type: "video", ID: 1},
}
TestActivePlayers provides sample active player data for Kodi testing
var TestEpisodes = map[int][]kodi.Episode{
1: {
{ID: 101, Label: "S01E01 - Pilot", Season: 1, Episode: 1, TVShowID: 1},
{ID: 102, Label: "S01E02 - Cat's in the Bag", Season: 1, Episode: 2, TVShowID: 1},
{ID: 103, Label: "S01E03 - ...And the Bag's in the River", Season: 1, Episode: 3, TVShowID: 1},
},
2: {
{ID: 201, Label: "S01E01 - Pilot", Season: 1, Episode: 1, TVShowID: 2},
{ID: 202, Label: "S01E02 - Diversity Day", Season: 1, Episode: 2, TVShowID: 2},
{ID: 203, Label: "S01E03 - Health Care", Season: 1, Episode: 3, TVShowID: 2},
},
3: {
{ID: 301, Label: "S01E01 - Winter Is Coming", Season: 1, Episode: 1, TVShowID: 3},
{ID: 302, Label: "S01E02 - The Kingsroad", Season: 1, Episode: 2, TVShowID: 3},
},
}
TestEpisodes provides sample episode data for Kodi testing, keyed by TV show ID
var TestMovies = []kodi.Movie{
{ID: 1, Label: "The Matrix"},
{ID: 2, Label: "Inception"},
{ID: 3, Label: "The Dark Knight"},
}
TestMovies provides sample movie data for Kodi testing
var TestNoActivePlayers = []kodi.Player{}
TestNoActivePlayers provides empty player data for Kodi testing
var TestTVShows = []kodi.TVShow{
{ID: 1, Label: "Breaking Bad"},
{ID: 2, Label: "The Office"},
{ID: 3, Label: "Game of Thrones"},
}
TestTVShows provides sample TV show data for Kodi testing
Functions ¶
func GetSystemDefsByID ¶
func GetSystemDefsByID() map[string]systemdefs.System
GetSystemDefsByID returns system definitions for testing
func GetTestSystemDefs ¶
func GetTestSystemDefs() []systemdefs.System
GetTestSystemDefs returns a collection of system definitions for testing
func NewAPIToken ¶
NewAPIToken creates a token that came from the API (not hardware scan)
func NewAmiiboToken ¶
NewAmiiboToken creates a sample Amiibo token with typical values
func NewArcadeGame ¶
func NewArcadeGame() *models.ActiveMedia
NewArcadeGame creates a sample arcade game ActiveMedia entry
func NewConsoleGame ¶
func NewConsoleGame() *models.ActiveMedia
NewConsoleGame creates a sample console game ActiveMedia entry
func NewCustomMedia ¶
func NewCustomMedia(launcherID, systemID, systemName, path, name string) *models.ActiveMedia
NewCustomMedia creates an ActiveMedia entry with custom values
func NewCustomToken ¶
NewCustomToken creates a token with custom values for specific test scenarios
func NewEmptyPlaylist ¶
NewEmptyPlaylist creates an empty playlist for testing
func NewEmptyToken ¶
NewEmptyToken creates a token with no text content (e.g., blank NFC tag)
func NewHandheldGame ¶
func NewHandheldGame() *models.ActiveMedia
NewHandheldGame creates a sample handheld game ActiveMedia entry
func NewHistoryEntry ¶
func NewHistoryEntry(tokenType, tokenID, tokenValue string, success bool) database.HistoryEntry
NewHistoryEntry creates a new history entry with custom values
func NewMapping ¶
NewMapping creates a new mapping with custom values
func NewMifareToken ¶
NewMifareToken creates a sample Mifare token with typical values
func NewModernGame ¶
func NewModernGame() *models.ActiveMedia
NewModernGame creates a sample modern game ActiveMedia entry
func NewNFCToken ¶
NewNFCToken creates a sample NFC token with typical values
func NewRetroGame ¶
func NewRetroGame() *models.ActiveMedia
NewRetroGame creates a sample retro game ActiveMedia entry
func NewRetroPlaylist ¶
NewRetroPlaylist creates a retro gaming playlist
func NewSamplePlaylist ¶
NewSamplePlaylist creates a sample playlist with typical values
func NewUnsafeToken ¶
NewUnsafeToken creates a token marked as unsafe (contains potentially harmful content)
func SampleMedia ¶
func SampleMedia() []*models.ActiveMedia
SampleMedia returns a collection of sample media for testing
func SamplePlaylists ¶
SamplePlaylists returns a collection of sample playlists for testing
func SampleTokens ¶
SampleTokens returns a collection of sample tokens for testing
Types ¶
type MediaCollection ¶
type MediaCollection struct {
RetroGame *models.ActiveMedia
ModernGame *models.ActiveMedia
ArcadeGame *models.ActiveMedia
ConsoleGame *models.ActiveMedia
HandheldGame *models.ActiveMedia
}
MediaCollection represents a set of related media entries for comprehensive testing
func NewMediaCollection ¶
func NewMediaCollection() *MediaCollection
NewMediaCollection creates a complete set of test media entries
func (*MediaCollection) AllMedia ¶
func (mc *MediaCollection) AllMedia() []*models.ActiveMedia
AllMedia returns all media entries in the collection as a slice
func (*MediaCollection) LauncherIDs ¶
func (mc *MediaCollection) LauncherIDs() []string
LauncherIDs returns a slice of all launcher IDs in the collection
func (*MediaCollection) MediaByLauncherID ¶
func (mc *MediaCollection) MediaByLauncherID(launcherID string) *models.ActiveMedia
MediaByLauncherID returns the media entry for a given launcher ID, or nil if not found
func (*MediaCollection) MediaBySystemID ¶
func (mc *MediaCollection) MediaBySystemID(systemID string) *models.ActiveMedia
MediaBySystemID returns the media entry for a given system ID, or nil if not found
func (*MediaCollection) RetroMedia ¶
func (mc *MediaCollection) RetroMedia() []*models.ActiveMedia
RetroMedia returns media entries for retro systems
func (*MediaCollection) SystemIDs ¶
func (mc *MediaCollection) SystemIDs() []string
SystemIDs returns a slice of all system IDs in the collection
type TokenCollection ¶
type TokenCollection struct {
NFC *tokens.Token
Mifare *tokens.Token
Amiibo *tokens.Token
Empty *tokens.Token
API *tokens.Token
Unsafe *tokens.Token
}
TokenCollection represents a set of related tokens for comprehensive testing
func NewTokenCollection ¶
func NewTokenCollection() *TokenCollection
NewTokenCollection creates a complete set of test tokens
func (*TokenCollection) AllTokens ¶
func (tc *TokenCollection) AllTokens() []*tokens.Token
AllTokens returns all tokens in the collection as a slice
func (*TokenCollection) HardwareTokens ¶
func (tc *TokenCollection) HardwareTokens() []*tokens.Token
HardwareTokens returns tokens that came from hardware (not API)
func (*TokenCollection) SafeTokens ¶
func (tc *TokenCollection) SafeTokens() []*tokens.Token
SafeTokens returns only tokens that are not marked as unsafe