Documentation
¶
Overview ¶
Package container decides when a directory of indexed media collapses to a single logical launch target, such as a disc folder holding one cue sheet beside its bin tracks. The rule is shared by the MediaDB queries that resolve containers from SQL and by scrapers that resolve them from an in-memory media index, so both agree on what counts as one game.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func MayHaveContainerTarget ¶ added in v2.17.1
MayHaveContainerTarget reports whether a media path could sit in a directory whose launch target is a different file. Only the extensions that can accompany a cue sheet or an m3u playlist qualify, so a caller holding an ordinary rom can skip a container lookup entirely. The m3u companion set contains the cue set, so one test covers both kinds: a .bin may be standing in for a cue, and a .cue or .chd for an m3u. An .m3u itself is excluded because promoting one could only return itself.
func MediaExt ¶
MediaExt returns the lowercased extension of a slash-separated media path, including the leading dot, or an empty string when there is none.
func ParentDir ¶
ParentDir returns the immediate browse parent of an indexed media path, including the trailing slash. Virtual media collapses to its scheme prefix because those paths have no directory hierarchy.
Indexed paths are normally stored forward-slashed, but one that reached the row from filepath.Join carries the host separator instead. Searching only for "/" would return nothing for those, and an empty parent resolves to no container at all, silently dropping folder artwork on Windows.
func SelectLaunchMedia ¶
SelectLaunchMedia returns the single logical launch target for a directory's direct media rows, or nil when the set is ambiguous. A lone file is its own target; otherwise one m3u playlist or one cue sheet surrounded only by its companion files stands in for the set.
Types ¶
type Index ¶
type Index struct {
// contains filtered or unexported fields
}
Index answers container questions from a set of already-loaded media rows. Callers that hold a whole system's media in memory, such as scrapers, use it to resolve directories without issuing a query per candidate.
func NewIndex ¶
NewIndex builds a container index over rows. Missing media is excluded so the result matches what the equivalent MediaDB queries would return.