Documentation ¶
Index ¶
- Constants
- func GenerateID() (id string)
- type DefaultTrack
- func (track *DefaultTrack) Album() string
- func (track *DefaultTrack) Artist() string
- func (track *DefaultTrack) Artists() string
- func (track *DefaultTrack) CoverURL() string
- func (track *DefaultTrack) Download() (io.ReadCloser, error)
- func (track *DefaultTrack) Duration() int
- func (track *DefaultTrack) Href() string
- func (track *DefaultTrack) ID() string
- func (track *DefaultTrack) ISRC() string
- func (track *DefaultTrack) IsRadio() bool
- func (track *DefaultTrack) PlayID() string
- func (track *DefaultTrack) Populate() error
- func (track *DefaultTrack) SpotifyURI() string
- func (track *DefaultTrack) Stream() (Stream, error)
- func (track *DefaultTrack) Title() string
- type LyricsLine
- type LyricsResult
- type LyricsTime
- type MusicSource
- type MusicSourceInfo
- type Stream
- type StreamFormat
- type Track
- type TrackMetadata
- type TrackWithLyrics
Constants ¶
const ( RawStream = iota MP3Stream WebMStream VorbisStream )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DefaultTrack ¶
type DefaultTrack struct{}
DefaultTrack represents the metadata will be shown when nothing is playing
func (*DefaultTrack) Album ¶
func (track *DefaultTrack) Album() string
func (*DefaultTrack) Artist ¶
func (track *DefaultTrack) Artist() string
func (*DefaultTrack) Artists ¶
func (track *DefaultTrack) Artists() string
func (*DefaultTrack) CoverURL ¶
func (track *DefaultTrack) CoverURL() string
func (*DefaultTrack) Download ¶
func (track *DefaultTrack) Download() (io.ReadCloser, error)
func (*DefaultTrack) Duration ¶
func (track *DefaultTrack) Duration() int
func (*DefaultTrack) Href ¶ added in v0.6.0
func (track *DefaultTrack) Href() string
func (*DefaultTrack) ID ¶
func (track *DefaultTrack) ID() string
func (*DefaultTrack) ISRC ¶
func (track *DefaultTrack) ISRC() string
func (*DefaultTrack) IsRadio ¶ added in v1.0.0
func (track *DefaultTrack) IsRadio() bool
func (*DefaultTrack) PlayID ¶
func (track *DefaultTrack) PlayID() string
func (*DefaultTrack) Populate ¶
func (track *DefaultTrack) Populate() error
func (*DefaultTrack) SpotifyURI ¶
func (track *DefaultTrack) SpotifyURI() string
func (*DefaultTrack) Stream ¶ added in v0.6.0
func (track *DefaultTrack) Stream() (Stream, error)
Stream is intentionally not implemented on this track type
func (*DefaultTrack) Title ¶
func (track *DefaultTrack) Title() string
type LyricsLine ¶
type LyricsLine struct { Text string `json:"text"` Translated string `json:"translated"` Time LyricsTime `json:"time"` Original string `json:"original"` }
LyricsLine contains informations about a piece of lyrics
type LyricsResult ¶
type LyricsResult struct { RawLyrics string `json:"txt"` SyncedLyrics []LyricsLine `json:"lrc"` Language string `json:"lang"` }
LyricsResult represents a result of a lyrics query
type LyricsTime ¶
type LyricsTime struct { Hundredths int `json:"hundredths"` Minutes int `json:"minutes"` Seconds int `json:"seconds"` Total float64 `json:"total"` }
LyricsTime represents the time that the lyrics will be shown
type MusicSource ¶ added in v1.0.0
type MusicSource interface { Search(query string) ([]Track, error) Name() string DisplayName() string }
MusicSource is an interface for a music source
type MusicSourceInfo ¶ added in v1.0.0
type MusicSourceInfo struct { //Name is the full name of the source Name string `json:"name"` //DisplayName is the shortened name of the source, used to display on search bar DisplayName string `json:"display_name"` //ID is the source's id, assigned by the server, used for querying tracks ID int `json:"id"` }
MusicSourceInfo contains information about a music source
func GetMusicSourceInfo ¶ added in v1.0.0
func GetMusicSourceInfo(s MusicSource) MusicSourceInfo
type Stream ¶ added in v1.0.0
type Stream interface { Format() int Body() io.ReadCloser }
Stream is an encoded audio stream
type StreamFormat ¶ added in v1.0.0
type StreamFormat int
type Track ¶
type Track interface { ID() string IsRadio() bool Title() string Artist() string Artists() string Album() string ISRC() string Href() string CoverURL() string Duration() int SpotifyURI() string PlayID() string Populate() error Stream() (Stream, error) }
Track represents a track from any sources
type TrackMetadata ¶
type TrackMetadata struct { Title string `json:"title"` IsRadio bool `json:"is_radio"` Duration int `json:"duration"` Artist string `json:"artist"` Artists string `json:"artists"` Album string `json:"album"` CoverURL string `json:"cover"` Lyrics LyricsResult `json:"lyrics"` PlayID string `json:"playId"` SpotifyURI string `json:"spotifyURI"` ID string `json:"id"` Href string `json:"href"` }
TrackMetadata contains essential informations about a track for client
func GetMetadata ¶
func GetMetadata(track Track) (d TrackMetadata)
GetMetadata returns a new TrackMetadata created from a provided Track
type TrackWithLyrics ¶ added in v1.0.0
type TrackWithLyrics interface { Track GetLyrics() (LyricsResult, error) }
TrackWithLyrics is a track that is responsible for fetching its own lyrics