diff --git a/service.go b/service.go index 32a36c1..480634d 100644 --- a/service.go +++ b/service.go @@ -89,14 +89,14 @@ func FindServiceAndAdd(user *gumble.User, url string) error { // Loop through all songs and add to the queue oldLength := dj.queue.Len() - for song := range songArray { + for songToAdd := range songArray { // Check song is not too long - time, _ := time.ParseDuration(song.Duration()) + time, _ := time.ParseDuration(songToAdd.Duration) if dj.conf.General.MaxSongDuration == 0 || int(time.Seconds()) <= dj.conf.General.MaxSongDuration { - if !isNil(song.Playlist()) { - title = song.Playlist().Title() + if !isNil(songToAdd.Playlist()) { + title = songToAdd.Playlist().Title() } else { - title = song.Title() + title = songToAdd.Title() } // Add song to queue diff --git a/youtube_dl.go b/youtube_dl.go index 64d60b1..b2ae282 100644 --- a/youtube_dl.go +++ b/youtube_dl.go @@ -28,7 +28,7 @@ type YouTubeSong struct { title string thumbnail string submitter *gumble.User - duration int + Duration int url string offset int format string @@ -74,7 +74,7 @@ func (dl *YouTubeSong) Download() error { } // Play plays the song. Once the song is playing, a notification is displayed in a text message that features the song -// thumbnail, URL, title, duration, and submitter. +// thumbnail, URL, title, Duration, and submitter. func (dl *YouTubeSong) Play() { if dl.offset != 0 { offsetDuration, _ := time.ParseDuration(fmt.Sprintf("%ds", dl.offset)) @@ -85,7 +85,7 @@ func (dl *YouTubeSong) Play() { panic(err) } else { message := `` - message = fmt.Sprintf(message, dl.thumbnail, dl.url, dl.title, dl.duration, dl.submitter.Name) + message = fmt.Sprintf(message, dl.thumbnail, dl.url, dl.title, dl.Duration, dl.submitter.Name) if !isNil(dl.playlist) { message = fmt.Sprintf(message+``, dl.playlist.Title()) } @@ -167,9 +167,9 @@ func (dl *YouTubeSong) Filename() string { return dl.id + "." + dl.format } -// Duration returns the duration of the Song. -func (dl *YouTubeSong) Duration() string { - timeDuration, _ := time.ParseDuration(stvconv.Iota(dl.duration) + "s") +// Duration returns the Duration of the Song. +func (dl *YouTubeSong) DurationString() string { + timeDuration, _ := time.ParseDuration(stvconv.Iota(dl.Duration) + "s") return timeDuration.String() }
%s (%s)
Added by %s
From playlist "%s"