Fixed panic when a song exceeded allowed duration

pull/42/head
Jake 2015-02-17 19:47:57 +00:00 committed by Jake
parent 541f371239
commit 38be691913
1 changed files with 4 additions and 3 deletions

View File

@ -58,9 +58,9 @@ func NewPlaylist(user, id string) (*Playlist, error) {
id: id,
title: playlistTitle,
}
j := 0
for i := 0; i < playlistItems; i++ {
index := strconv.Itoa(i)
index := strconv.Itoa(j)
songTitle, _ := jq.String("data", "items", index, "video", "title")
songId, _ := jq.String("data", "items", index, "video", "id")
songThumbnail, _ := jq.String("data", "items", index, "video", "thumbnail", "hqDefault")
@ -78,7 +78,8 @@ func NewPlaylist(user, id string) (*Playlist, error) {
// Don't spam the chat if a playlist contains songs that are too long
if dj.conf.General.MaxSongDuration == 0 || duration <= dj.conf.General.MaxSongDuration {
dj.queue.AddSong(newSong)
}
j += 1
}
}
return playlist, nil