common

package
v0.8.2 Latest Latest
Warning

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

Go to latest
Published: Aug 10, 2020 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	//Radio (listen.moe) Source
	Radio = 0
	//Deezer Source
	Deezer = 1
	//CSN Source
	CSN = 2
	//Youtube Source
	Youtube = 3
)

Variables

This section is empty.

Functions

func GenerateID

func GenerateID() (id string)

GenerateID generates an unique alphanumberic string

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) PlayID

func (track *DefaultTrack) PlayID() string

func (*DefaultTrack) Populate

func (track *DefaultTrack) Populate() error

func (*DefaultTrack) Source

func (track *DefaultTrack) Source() int

func (*DefaultTrack) SpotifyURI

func (track *DefaultTrack) SpotifyURI() string

func (*DefaultTrack) Stream added in v0.6.0

func (track *DefaultTrack) Stream() (io.ReadCloser, error)

Stream returns a 16/48 pcm stream of the track

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 Track

type Track interface {
	ID() string
	Source() int
	Title() string
	Artist() string
	Artists() string
	Album() string
	ISRC() string
	Href() string
	CoverURL() string
	Duration() int
	SpotifyURI() string
	PlayID() string
	Populate() error
	Download() (io.ReadCloser, error)
	Stream() (io.ReadCloser, error)
}

Track represents a track from any sources

type TrackMetadata

type TrackMetadata struct {
	Title      string       `json:"title"`
	Source     int          `json:"source"`
	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

Jump to

Keyboard shortcuts

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