music

package
v0.0.0-...-9d742bf Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2022 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
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

type MusicLibraryFileSystem = fs.ReadDirFS

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.

Jump to

Keyboard shortcuts

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