music

package
v0.0.0-...-94c99f4 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2019 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Heading

func Heading(attr Attribute) string

Heading returns the string representation for a particular attribute

Types

type Attribute

type Attribute int
const (
	Title Attribute = iota
	Artist
	Album
	Year
	Length
)

type Playlist

type Playlist struct {
	Tracks []*Track
}

Playlist represents a collection of tracks

func (Playlist) OrderBy

func (p Playlist) OrderBy(order []Attribute)

OrderBy sorts `Playlist.Tracks` into an ascending order (small to large, a-z...) specified by a slice of `Attribute`s such as `[]Attribute{Year, Album, Title}`.

For example, given the table: Title Artist Album Year Length ----- ------ ----- ---- ------ Go Chemical Brothers Born In The Echoes 2015 4m20s (Come On) Let's Go! Smashing Pumpkins Zeitgeist 2007 3m19s Go blink-182 blink-182 2003 1m53s

Sorting by `playlist.OrderBy([]Attribute{Title})` will sort by titles, yielding: Title Artist Album Year Length (Come On) Let's Go! Smashing Pumpkins Zeitgeist 2007 3m19s Go Chemical Brothers Born In The Echoes 2015 4m20s Go blink-182 blink-182 2003 1m53s

Sorting by `playlist.OrderBy([]Attribute{Year, Title})` will first sort by the year then the title, yielding: Title Artist Album Year Length ----- ------ ----- ---- ------ Go blink-182 blink-182 2003 1m53s (Come On) Let's Go! Smashing Pumpkins Zeitgeist 2007 3m19s Go Chemical Brothers Born In The Echoes 2015 4m20s

type Track

type Track struct {
	Title  string
	Artist string
	Album  string
	Year   int
	Length time.Duration
}

Track represents a song or piece of music

Jump to

Keyboard shortcuts

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