From 6a954e04b13fa13469f5b4fbf120aa8315fabd2c Mon Sep 17 00:00:00 2001 From: Jake Date: Tue, 17 Feb 2015 19:14:25 +0000 Subject: [PATCH] Check whether song duration is restricted first --- song.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/song.go b/song.go index f632334..05f4beb 100644 --- a/song.go +++ b/song.go @@ -60,7 +60,7 @@ func NewSong(user, id string, playlist *Playlist) (*Song, error) { duration, _ := jq.Int("data", "duration") videoDuration := fmt.Sprintf("%d:%02d", duration/60, duration%60) - if duration > dj.conf.General.MaxSongDuration && dj.conf.General.MaxSongDuration > 0 { + if dj.conf.General.MaxSongDuration > 0 && duration > dj.conf.General.MaxSongDuration { return nil, errors.New("video exceeds the maximum allowed duration.") }