From e05ce579d997a8b51f90f2c8450a1dfcd34ca802 Mon Sep 17 00:00:00 2001 From: MichaelOultram Date: Sat, 26 Sep 2015 16:50:19 +0100 Subject: [PATCH] Debugging why a single video can not be added --- service.go | 2 ++ strings.go | 2 +- youtube_dl.go | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/service.go b/service.go index 55dc7ba..4e9401e 100644 --- a/service.go +++ b/service.go @@ -90,6 +90,7 @@ 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 { + fmt.Printf("Song loop, title: %s, duration: %d", song.Title(), int(song.Duration().Seconds())) // Check song is not too long if dj.conf.General.MaxSongDuration == 0 || int(song.Duration().Seconds()) <= dj.conf.General.MaxSongDuration { if !isNil(song.Playlist()) { @@ -103,6 +104,7 @@ func FindServiceAndAdd(user *gumble.User, url string) error { songsAdded++ } } + fmt.Printf("Songs added: %d", songsAdded) // Alert channel of added song/playlist if songsAdded == 0 { diff --git a/strings.go b/strings.go index 54b55f5..ec69cf5 100644 --- a/strings.go +++ b/strings.go @@ -78,7 +78,7 @@ const SONG_ADDED_HTML = ` // Message shown to channel when a playlist is added to the queue by a user. const PLAYLIST_ADDED_HTML = ` - %s has added the %s "%s" to the queue. + %s has added the playlist "%s" to the queue. ` // Message shown to channel when a song has been skipped. diff --git a/youtube_dl.go b/youtube_dl.go index acecf24..d7110bd 100644 --- a/youtube_dl.go +++ b/youtube_dl.go @@ -87,9 +87,9 @@ 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.String(), dl.submitter.Name) if !isNil(dl.playlist) { - message = fmt.Sprintf(message+``, dl.playlist.Title()) + message = fmt.Sprintf(message+``, dl.Playlist().Title()) } dj.client.Self.Channel.Send(message+`
%s (%s)
Added by %s
From playlist "%s"
From playlist "%s"
`, false)