Documentation
¶
Overview ¶
Package esmedia resolves local EmulationStation-style media folders and paths.
Index ¶
- Variables
- func ArtworkFallbackNames(gamePath, systemRootPath string) []string
- func FallbackArtworkNames(stem string) []string
- func IsHomeRelativePath(esPath string) bool
- func MimeFromExt(path string) string
- func PathWithinRoot(path, root string) bool
- func ResolvePath(esPath, systemRootPath string) string
- func ResolvePathAbs(esPath, systemRootPath string) (string, bool)
- func StatMediaDirs(rootPath string) map[string]string
- func StatMediaDirsFS(fs afero.Fs, rootPath string) map[string]string
- type File
Constants ¶
This section is empty.
Variables ¶
var ArtworkDirCandidates = map[string][]string{ string(tags.TagPropertyImageImage): {"image", "images", "miximages", "custom"}, string(tags.TagPropertyImageBoxart): { "boxart", "boxart2d", "box2d", "boxart2dfront", "box2dfront", "cover", "covers", }, string(tags.TagPropertyImageBoxart3D): {"boxart3d", "3dbox", "3dboxes"}, string(tags.TagPropertyImageBoxartSide): {"boxart2dside"}, string(tags.TagPropertyImageBoxartBack): {"boxart2dback", "backcover", "backcovers"}, string(tags.TagPropertyImageScreenshot): {"screenshot", "screenshots"}, string(tags.TagPropertyImageThumbnail): { "thumbnail", "thumbnails", "box2dfront", "boxart2dfront", "supporttexture", }, string(tags.TagPropertyImageMarquee): {"marquee", "marquees"}, string(tags.TagPropertyImageWheel): {"wheel", "wheels", "logo", "logos"}, string(tags.TagPropertyImageFanart): {"fanart", "fanarts"}, string(tags.TagPropertyImageTitleshot): { "titleshot", "titleshots", "titlescreen", "titlescreens", "screenshottitle", }, string(tags.TagPropertyImageMap): {"map", "maps"}, }
ArtworkDirCandidates maps each TagPropertyImage value to ordered media sub-directory names under <systemRootPath>/media/.
var ArtworkExtensions = []string{".png", ".jpg", ".jpeg", ".webp"}
ArtworkExtensions are checked in order when deriving artwork filenames.
Functions ¶
func ArtworkFallbackNames ¶
ArtworkFallbackNames returns candidate artwork filenames for gamePath under systemRootPath. For games in subdirectories, mirrored paths are checked before flat filenames.
func FallbackArtworkNames ¶
FallbackArtworkNames returns <stem> plus each supported artwork extension.
func IsHomeRelativePath ¶
IsHomeRelativePath reports whether an ES path starts with ~/ or ~\.
func MimeFromExt ¶
MimeFromExt returns a MIME type based on file extension.
func PathWithinRoot ¶
PathWithinRoot reports whether path is inside root after absolute-path cleanup.
func ResolvePath ¶
ResolvePath converts an EmulationStation path to an absolute path under systemRootPath. Paths that cannot be resolved or escape systemRootPath return an empty string.
func ResolvePathAbs ¶
ResolvePathAbs converts an EmulationStation path to an absolute filesystem path without enforcing that the result stays inside systemRootPath.
func StatMediaDirs ¶
StatMediaDirs reads <rootPath>/media and returns subdirectory name to path.
Types ¶
type File ¶
File is a local media file discovered in an EmulationStation media folder.
func FindFileAcrossRootsFS ¶
func FindFileAcrossRootsFS( fs afero.Fs, fallbackNames []string, candidates []string, orderedAvailableDirs []map[string]string, ) *File
FindFileAcrossRootsFS searches each root's media directories in order and returns the first matching file. orderedAvailableDirs must be in priority order (RootDirs order); the first root with a hit wins. Within a root the existing candidate-directory order applies.