Added panic on audio play fail

This commit is contained in:
Matthieu Grieger 2015-02-02 11:19:24 -08:00
parent b0a2704e26
commit 5c6a87bdc0
2 changed files with 8 additions and 2 deletions

View file

@ -1,6 +1,9 @@
MumbleDJ Changelog
==================
### February 2, 2015 -- `v2.3.4`
* Added panic on audio play fail for debugging purposes.
### January 30, 2015 -- `v2.3.3`
* Fixed private messages crashing the bot when the target user switches channels or disconnects.

View file

@ -79,8 +79,11 @@ func (s *Song) Download() error {
// Plays the song. Once the song is playing, a notification is displayed in a text message that features the video thumbnail, URL, title,
// duration, and submitter.
func (s *Song) Play() {
dj.audioStream.Play(fmt.Sprintf("%s/.mumbledj/songs/%s.m4a", dj.homeDir, s.youtubeId))
dj.client.Self().Channel().Send(fmt.Sprintf(NOW_PLAYING_HTML, s.thumbnailUrl, s.youtubeId, s.title, s.duration, s.submitter), false)
if err := dj.audioStream.Play(fmt.Sprintf("%s/.mumbledj/songs/%s.m4a", dj.homeDir, s.youtubeId)); err != nil {
panic(err)
} else {
dj.client.Self().Channel().Send(fmt.Sprintf(NOW_PLAYING_HTML, s.thumbnailUrl, s.youtubeId, s.title, s.duration, s.submitter), false)
}
}
// Deletes the song from ~/.mumbledj/songs.