Documentation ¶
Index ¶
- func GetChannelID(token, clientID string) (string, error)
- func GetOAuthToken(clientID string) string
- func GetSongs(a *Music, songsCollectionURL string) error
- func InitSpeaker() error
- func ListenChannelPoints(chanID, clientID, oauthToken string, callback func(TwitchRedemption))
- func SelectSong(artists *Music) (*Artist, *Album, *Song)
- func SynthesiseText(t string) string
- type Album
- type Artist
- type Music
- type Player
- type Song
- type TwitchRedemption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetChannelID ¶
GetChannelID retrieves the channel ID for the OAuth token provided, and returns it as a string
func GetOAuthToken ¶
GetOAuthToken gets a User OAuth Token from the Twitch API and returns it as a string. This function needs further work: it is not fully automated, requiring user involvement (which also has an ugly UX)
func GetSongs ¶
GetSongs populates the provided Music object with the song database found at the URL `songsCollectionURL`.
func InitSpeaker ¶
func InitSpeaker() error
func ListenChannelPoints ¶
func ListenChannelPoints(chanID, clientID, oauthToken string, callback func(TwitchRedemption))
ListenChannelPoints starts a WebSocket listening to the Twitch PubSub API for Channel Point redemptions, which calls callback with the provided file handle and the reward title as a string
func SelectSong ¶
SelectSong asks the user for a song from the artists Music object, and returns pointers to the selected Artist, Album, and Song object within
func SynthesiseText ¶
SynthesiseText uses the Google Cloud Text-to-Speech API to generate an MP3 audio file speaking the provided string t, and returns the file name of the created MP3 file. NB. this function requires that a valid Google API credential file is present and referred to by the 'GOOGLE_APPLICATION_CREDENTIALS' environment variable.
Types ¶
type Album ¶
Album is a structure storing the album name and a dynamic array of Song objects to represent the songs present on an album.
type Artist ¶
Artist is a structure storing the artist name and a dynamic array of Album objects to represent the artist's albums.
type Music ¶
Music is a structure storing a dynamic array within which to store the Artist objects, to be populated by parsing the JSON data file.
type Player ¶
type Player struct { Playing bool // contains filtered or unexported fields }
func (*Player) AdjustVolume ¶
func (*Player) TogglePause ¶
func (p *Player) TogglePause()
type TwitchRedemption ¶
type TwitchRedemption struct { ID string `json:"id"` User twitchUser `json:"user"` ChannelID string `json:"channel_id"` RedeemedAt time.Time `json:"redeemed_at"` Reward twitchReward `json:"reward"` UserInput string `json:"user_input"` Status string `json:"status"` }
TwitchRedemption represents a Channel Point reward redemption on Twitch.