Fixing build errors
This commit is contained in:
parent
02b9778cc2
commit
9d78f9fdc0
10
service.go
10
service.go
|
@ -89,14 +89,14 @@ func FindServiceAndAdd(user *gumble.User, url string) error {
|
||||||
|
|
||||||
// Loop through all songs and add to the queue
|
// Loop through all songs and add to the queue
|
||||||
oldLength := dj.queue.Len()
|
oldLength := dj.queue.Len()
|
||||||
for song := range songArray {
|
for songToAdd := range songArray {
|
||||||
// Check song is not too long
|
// 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 dj.conf.General.MaxSongDuration == 0 || int(time.Seconds()) <= dj.conf.General.MaxSongDuration {
|
||||||
if !isNil(song.Playlist()) {
|
if !isNil(songToAdd.Playlist()) {
|
||||||
title = song.Playlist().Title()
|
title = songToAdd.Playlist().Title()
|
||||||
} else {
|
} else {
|
||||||
title = song.Title()
|
title = songToAdd.Title()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add song to queue
|
// Add song to queue
|
||||||
|
|
|
@ -28,7 +28,7 @@ type YouTubeSong struct {
|
||||||
title string
|
title string
|
||||||
thumbnail string
|
thumbnail string
|
||||||
submitter *gumble.User
|
submitter *gumble.User
|
||||||
duration int
|
Duration int
|
||||||
url string
|
url string
|
||||||
offset int
|
offset int
|
||||||
format string
|
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
|
// 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() {
|
func (dl *YouTubeSong) Play() {
|
||||||
if dl.offset != 0 {
|
if dl.offset != 0 {
|
||||||
offsetDuration, _ := time.ParseDuration(fmt.Sprintf("%ds", dl.offset))
|
offsetDuration, _ := time.ParseDuration(fmt.Sprintf("%ds", dl.offset))
|
||||||
|
@ -85,7 +85,7 @@ func (dl *YouTubeSong) Play() {
|
||||||
panic(err)
|
panic(err)
|
||||||
} else {
|
} 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 := `<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, dl.submitter.Name)
|
||||||
if !isNil(dl.playlist) {
|
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())
|
||||||
}
|
}
|
||||||
|
@ -167,9 +167,9 @@ func (dl *YouTubeSong) Filename() string {
|
||||||
return dl.id + "." + dl.format
|
return dl.id + "." + dl.format
|
||||||
}
|
}
|
||||||
|
|
||||||
// Duration returns the duration of the Song.
|
// Duration returns the Duration of the Song.
|
||||||
func (dl *YouTubeSong) Duration() string {
|
func (dl *YouTubeSong) DurationString() string {
|
||||||
timeDuration, _ := time.ParseDuration(stvconv.Iota(dl.duration) + "s")
|
timeDuration, _ := time.ParseDuration(stvconv.Iota(dl.Duration) + "s")
|
||||||
return timeDuration.String()
|
return timeDuration.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Reference in a new issue