Documentation ¶
Index ¶
Constants ¶
const MusicPath = "/music" // It is a volume in the Docker image
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MusicLibraryExplorer ¶
type MusicLibraryExplorer interface { // ListContents reads a given folder in the music library and sorts children into folders // (directories) and songs. It ignores other files. Given "." as folderPath, it will return // the contents of the root music library folder. ListContents(folderPath string) ([]SubFolder, []Song, error) }
MusicLibraryExplorer allows to explore the contents of the music library folders. It needs a MusicLibraryFileSystem. It transforms Directories and Files into Folders and Songs structs.
func NewMusicLibraryExplorer ¶
func NewMusicLibraryExplorer(filesystem fs.ReadDirFS) MusicLibraryExplorer
NewMusicLibraryExplorer creates a new MusicLibraryExplorer
type MusicLibraryFileSystem ¶
MusicLibraryFileSystem allows to read the music library's root folder and to open the music files. It does not allow to open parents of the music library's root folder.
type Song ¶
type Song struct { Title string // Title of the song URI string // URI to play the song. For example "/music/Symphonic Metal/Nightwish/Dark Passion Play/7 Days to the Wolves.ogg" }
Song represents a music file. It is distinguished by media type (audio/mp3, audio/flac, etc.) Most of its fields mirror tags such as ID3 tags for MP3.
type SubFolder ¶
type SubFolder struct { Name string // Basename of the folder. For example "Dark Passion Play" Path string // Absolute path to the folder. For example "/music/Symphonic Metal/Nightwish/Dark Passion Play/" }
SubFolder represents a folder that is either top-level or a child of a top-level music folder. A SubFolder can have zero or many children SubFolders.