Check whether song duration is restricted first
This commit is contained in:
parent
eec8d9c3d2
commit
6a954e04b1
2
song.go
2
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.")
|
||||
}
|
||||
|
||||
|
|
Reference in a new issue