Made the maximum song duration optional

This commit is contained in:
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 (""). # 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." DefaultComment = "Hello! I am a bot. Type !help for a list of commands."
# Maximum song duration in seconds # Maximum song duration in seconds (0 = unristrcted)
# Default Value 600 # Default Value: 0
MaxSongDuration = 600 MaxSongDuration = 0
[Cache] [Cache]

View file

@ -60,7 +60,7 @@ func NewSong(user, id string, playlist *Playlist) (*Song, error) {
duration, _ := jq.Int("data", "duration") duration, _ := jq.Int("data", "duration")
videoDuration := fmt.Sprintf("%d:%02d", duration/60, duration%60) 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.") return nil, errors.New("video exceeds the maximum allowed duration.")
} }