Made the maximum song duration optional

pull/42/head
Jake 2015-02-17 18:47:06 +00:00 committed by Jake
parent d11b6326cc
commit d37995b136
2 changed files with 4 additions and 4 deletions

View File

@ -22,9 +22,9 @@ PlaylistSkipRatio = 0.5
# NOTE: If you do not want a comment by default, set the variable equal to an empty string ("").
DefaultComment = "Hello! I am a bot. Type !help for a list of commands."
# Maximum song duration in seconds
# Default Value 600
MaxSongDuration = 600
# Maximum song duration in seconds (0 = unristrcted)
# Default Value: 0
MaxSongDuration = 0
[Cache]

View File

@ -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 {
if duration > dj.conf.General.MaxSongDuration && dj.conf.General.MaxSongDuration > 0 {
return nil, errors.New("video exceeds the maximum allowed duration.")
}