Support MaxSongPerPlaylist configuration for soundcloud playlists

This commit is contained in:
Gabriel Plassard 2015-10-16 23:15:33 +02:00
parent 6776d6869f
commit c1f89fbaaf

View file

@ -66,6 +66,9 @@ func (sc SoundCloud) NewRequest(user *gumble.User, url string) ([]Song, error) {
title: title, title: title,
} }
if (dj.conf.General.MaxSongPerPlaylist > 0 && len(tracks) > dj.conf.General.MaxSongPerPlaylist){
tracks = tracks[:dj.conf.General.MaxSongPerPlaylist]
}
// Add all tracks // Add all tracks
for _, t := range tracks { for _, t := range tracks {
if song, err := sc.NewSong(user, jsonq.NewQuery(t), 0, playlist); err == nil { if song, err := sc.NewSong(user, jsonq.NewQuery(t), 0, playlist); err == nil {