Documentation
¶
Overview ¶
Package spotify contains an implementation of the spotify service.
Index ¶
Constants ¶
const ErrInvalidID = "Invalid playlist Id"
ErrInvalidID is the error for an invalid playlist id
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
spotify.Client
Auth spotify.Authenticator
AuthURL string
Session string
AuthChan chan bool
MusicChan chan Music
Spotify spotify.Client
SubredditPlaylist map[string]spotify.ID
User *spotify.PrivateUser
Logger *log.Entry
}
Client is the spotify client
func New ¶
New sets up a new spotify client. It takes the configuration and returns a client or an error.
func (*Client) AuthHandler ¶
func (c *Client) AuthHandler() http.HandlerFunc
AuthHandler is a simple http handler for the authentication callback.
func (*Client) Authenticate ¶
Authenticate handles the authentication against the Spotify API. It either opens the browser or tells the user to navigate to a URL. It will also block until authentication is done.
func (*Client) Listen ¶
func (c *Client) Listen()
Listen listens for incoming data on the music channel.
func (*Client) PreparePlaylists ¶
PreparePlaylists checks the playlists defined in the config and fetches them from Spotify. If a playlist is passed by name, it's created if it doesn't exist. It also connects the subreddits to a corresponding playlist id.