Fixing build issues

This commit is contained in:
MichaelOultram 2015-07-27 23:36:50 +01:00
parent 1ec27383af
commit 381da0faca

View file

@ -63,17 +63,20 @@ func (y YouTube) URLRegex(url string) bool {
// Creates the requested song/playlist and adds to the queue // Creates the requested song/playlist and adds to the queue
func (y YouTube) NewRequest(user *gumble.User, url string) error { func (y YouTube) NewRequest(user *gumble.User, url string) error {
shortURL := ""
startOffset := ""
youtubePlaylistPattern := `https?:\/\/www\.youtube\.com\/playlist\?list=([\w-]+)` youtubePlaylistPattern := `https?:\/\/www\.youtube\.com\/playlist\?list=([\w-]+)`
if re, err := regexp.Compile(youtubePlaylistPattern); err == nil { if re, err := regexp.Compile(youtubePlaylistPattern); err == nil {
if re.MatchString(url) { if re.MatchString(url) {
if dj.HasPermission(user.Name, dj.conf.Permissions.AdminAddPlaylists) { if dj.HasPermission(user.Name, dj.conf.Permissions.AdminAddPlaylists) {
shortURL := re.FindStringSubmatch(url)[1] shortURL = re.FindStringSubmatch(url)[1]
NewYouTubePlaylist(user.Name, shortURL) NewYouTubePlaylist(user.Name, shortURL)
} else { } else {
return errors.New("NO_PLAYLIST_PERMISSION") return errors.New("NO_PLAYLIST_PERMISSION")
} }
} else { } else {
matches = re.FindAllStringSubmatch(url, -1) matches := re.FindAllStringSubmatch(url, -1)
shortURL = matches[0][1] shortURL = matches[0][1]
if len(matches[0]) == 3 { if len(matches[0]) == 3 {
startOffset = matches[0][2] startOffset = matches[0][2]