Debugging why a single video can not be added

This commit is contained in:
MichaelOultram 2015-09-26 16:50:19 +01:00
parent a7be06533c
commit e05ce579d9
3 changed files with 5 additions and 3 deletions

View file

@ -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 {

View file

@ -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 = `
<b>%s</b> has added the %s "%s" to the queue.
<b>%s</b> has added the playlist "%s" to the queue.
`
// Message shown to channel when a song has been skipped.

View file

@ -87,9 +87,9 @@ func (dl *YouTubeSong) Play() {
panic(err)
} else {
message := `<table><tr><td align="center"><img src="%s" width=150 /></td></tr><tr><td align="center"><b><a href="%s">%s</a> (%s)</b></td></tr><tr><td align="center">Added by %s</td></tr>`
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+`<tr><td align="center">From playlist "%s"</td></tr>`, dl.playlist.Title())
message = fmt.Sprintf(message+`<tr><td align="center">From playlist "%s"</td></tr>`, dl.Playlist().Title())
}
dj.client.Self.Channel.Send(message+`</table>`, false)