spotify

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvertB62

func ConvertB62(id string) []byte

func GetCurrentWords

func GetCurrentWords(lyrics []LyricsLines, currentMs int) string

Types

type LyricsLines

type LyricsLines struct {
	StartTime int
	Words     string
}

type PlaybackState

type PlaybackState struct {
	TrackID string

	IsPlaying bool
	IsPaused  bool

	Current  time.Duration
	Duration time.Duration

	UpdatedAt time.Time
}

type SpotifyClient

type SpotifyClient struct {
	// contains filtered or unexported fields
}

func New

func New(token *Token, cookie string) *SpotifyClient

func (*SpotifyClient) CloseWebsocket

func (s *SpotifyClient) CloseWebsocket() error

func (*SpotifyClient) ConnectWebsocket

func (s *SpotifyClient) ConnectWebsocket() (chan *PlaybackState, error)

func (*SpotifyClient) GetLyrics

func (s *SpotifyClient) GetLyrics(trackID string) (lyrics []LyricsLines, err error)

func (*SpotifyClient) GetMetadata

func (s *SpotifyClient) GetMetadata(trackID string) (metadata *TrackMetadata, err error)

func (*SpotifyClient) PingHandler

func (s *SpotifyClient) PingHandler(conn *websocket.Conn)

func (*SpotifyClient) RefreshToken

func (s *SpotifyClient) RefreshToken() (*Token, error)

func (*SpotifyClient) RegisterDevice

func (s *SpotifyClient) RegisterDevice() (err error)

func (*SpotifyClient) UpdateState

func (s *SpotifyClient) UpdateState() (err error)

func (*SpotifyClient) WSHandler

func (s *SpotifyClient) WSHandler(conn *websocket.Conn, ch chan *PlaybackState)

type Token

type Token struct {
	AccessToken string
	ExpiresAt   time.Time
}

func (*Token) IsExpired

func (t *Token) IsExpired() bool

type TrackMetadata

type TrackMetadata struct {
	Artists string
	Album   string
	Name    string
}

Jump to

Keyboard shortcuts

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