Fixing build errors
This commit is contained in:
parent
d3b2afe8a0
commit
afb05faecb
|
@ -44,9 +44,9 @@ func (sc SoundCloud) URLRegex(url string) bool {
|
||||||
func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) {
|
func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) {
|
||||||
var apiResponse *jsonq.JsonQuery
|
var apiResponse *jsonq.JsonQuery
|
||||||
var err error
|
var err error
|
||||||
url := fmt.Sprintf("http://api.soundcloud.com/resolve?url=%s&client_id=%s", url, os.Getenv("SOUNDCLOUD_API_KEY"))
|
url = fmt.Sprintf("http://api.soundcloud.com/resolve?url=%s&client_id=%s", url, os.Getenv("SOUNDCLOUD_API_KEY"))
|
||||||
if apiResponse, err = PerformGetRequest(url); err != nil {
|
if apiResponse, err = PerformGetRequest(url); err != nil {
|
||||||
return nil, errors.New(INVALID_API_KEY)
|
return "", errors.New(INVALID_API_KEY)
|
||||||
}
|
}
|
||||||
|
|
||||||
tracks, err := apiResponse.ArrayOfObjects("tracks")
|
tracks, err := apiResponse.ArrayOfObjects("tracks")
|
||||||
|
@ -78,7 +78,7 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) (string, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a track and adds to the queue
|
// Creates a track and adds to the queue
|
||||||
func (sc SoundCloud) NewSong(user string, trackData *jsonq.JsonQuery, playlist SoundCloudPlaylist) (string, error) {
|
func (sc SoundCloud) NewSong(user string, trackData *jsonq.JsonQuery, playlist Playlist) (string, error) {
|
||||||
title, err := trackData.String("title")
|
title, err := trackData.String("title")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
|
@ -127,7 +127,7 @@ func (p *SoundCloudPlaylist) AddSkip(username string) error {
|
||||||
|
|
||||||
// RemoveSkip removes a skip from the playlist's skippers slice. If username is not in the slice
|
// RemoveSkip removes a skip from the playlist's skippers slice. If username is not in the slice
|
||||||
// an error is returned.
|
// an error is returned.
|
||||||
func (p *YouTubePlaylist) RemoveSkip(username string) error {
|
func (p *SoundCloudPlaylist) RemoveSkip(username string) error {
|
||||||
for i, user := range dj.playlistSkips[p.ID()] {
|
for i, user := range dj.playlistSkips[p.ID()] {
|
||||||
if username == user {
|
if username == user {
|
||||||
dj.playlistSkips[p.ID()] = append(dj.playlistSkips[p.ID()][:i], dj.playlistSkips[p.ID()][i+1:]...)
|
dj.playlistSkips[p.ID()] = append(dj.playlistSkips[p.ID()][:i], dj.playlistSkips[p.ID()][i+1:]...)
|
||||||
|
@ -138,14 +138,14 @@ func (p *YouTubePlaylist) RemoveSkip(username string) error {
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteSkippers removes the skippers entry in dj.playlistSkips.
|
// DeleteSkippers removes the skippers entry in dj.playlistSkips.
|
||||||
func (p *YouTubePlaylist) DeleteSkippers() {
|
func (p *SoundCloudPlaylist) DeleteSkippers() {
|
||||||
delete(dj.playlistSkips, p.ID())
|
delete(dj.playlistSkips, p.ID())
|
||||||
}
|
}
|
||||||
|
|
||||||
// SkipReached calculates the current skip ratio based on the number of users within MumbleDJ's
|
// SkipReached calculates the current skip ratio based on the number of users within MumbleDJ's
|
||||||
// channel and the number of usernames in the skippers slice. If the value is greater than or equal
|
// channel and the number of usernames in the skippers slice. If the value is greater than or equal
|
||||||
// to the skip ratio defined in the config, the function returns true, and returns false otherwise.
|
// to the skip ratio defined in the config, the function returns true, and returns false otherwise.
|
||||||
func (p *YouTubePlaylist) SkipReached(channelUsers int) bool {
|
func (p *SoundCloudPlaylist) SkipReached(channelUsers int) bool {
|
||||||
if float32(len(dj.playlistSkips[p.ID()]))/float32(channelUsers) >= dj.conf.General.PlaylistSkipRatio {
|
if float32(len(dj.playlistSkips[p.ID()]))/float32(channelUsers) >= dj.conf.General.PlaylistSkipRatio {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -153,11 +153,11 @@ func (p *YouTubePlaylist) SkipReached(channelUsers int) bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
// ID returns the id of the YouTubePlaylist.
|
// ID returns the id of the YouTubePlaylist.
|
||||||
func (p *YouTubePlaylist) ID() string {
|
func (p *SoundCloudPlaylist) ID() string {
|
||||||
return p.id
|
return p.id
|
||||||
}
|
}
|
||||||
|
|
||||||
// Title returns the title of the YouTubePlaylist.
|
// Title returns the title of the YouTubePlaylist.
|
||||||
func (p *YouTubePlaylist) Title() string {
|
func (p *SoundCloudPlaylist) Title() string {
|
||||||
return p.title
|
return p.title
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue