From a81f9340475b1227446db1d5c2a42f13cda892ab Mon Sep 17 00:00:00 2001 From: Michael Pacella Date: Thu, 11 Feb 2016 01:05:52 -0500 Subject: [PATCH 1/6] hack workaround to get certain youtube videos which do not provide m4a format audio to work. --format bestaudio can be used with youtube-dl instead of specifying the m4a format. --- service_youtube.go | 2 +- youtube_dl.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/service_youtube.go b/service_youtube.go index 268ec73..008e9d4 100644 --- a/service_youtube.go +++ b/service_youtube.go @@ -91,7 +91,7 @@ func (yt YouTube) NewSong(user *gumble.User, id, offset string, playlist Playlis offset: int(yt.parseTime(offset, `T\=(?P\d+D)?(?P\d+H)?(?P\d+M)?(?P\d+S)?`).Seconds()), duration: int(yt.parseTime(duration, `P(?P\d+D)?T(?P\d+H)?(?P\d+M)?(?P\d+S)?`).Seconds()), thumbnail: thumbnail, - format: "m4a", + format: "bestaudio", skippers: make([]string, 0), playlist: playlist, dontSkip: false, diff --git a/youtube_dl.go b/youtube_dl.go index ff39510..5139e1a 100644 --- a/youtube_dl.go +++ b/youtube_dl.go @@ -167,7 +167,7 @@ func (dl *AudioTrack) ID() string { // Filename returns the filename of the Song. func (dl *AudioTrack) Filename() string { - return dl.id + "." + dl.format + return dl.id + ".m4a" } // Duration returns duration for the Song. From d84260b0307157570b19b7a83096a1115f7870f0 Mon Sep 17 00:00:00 2001 From: Michael Pacella Date: Thu, 11 Feb 2016 01:13:22 -0500 Subject: [PATCH 2/6] realized that having bestaudio as a file extension is perfectly valid in this case so there is no need to tack m4a on arbitrarily --- youtube_dl.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/youtube_dl.go b/youtube_dl.go index 5139e1a..ff39510 100644 --- a/youtube_dl.go +++ b/youtube_dl.go @@ -167,7 +167,7 @@ func (dl *AudioTrack) ID() string { // Filename returns the filename of the Song. func (dl *AudioTrack) Filename() string { - return dl.id + ".m4a" + return dl.id + "." + dl.format } // Duration returns duration for the Song. From e14dc879a126cac22d311fc7fba25cde7ee0803c Mon Sep 17 00:00:00 2001 From: Matthieu Grieger Date: Fri, 12 Feb 2016 12:27:18 -0800 Subject: [PATCH 3/6] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 869a69b..752eeec 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ MumbleDJ Changelog ================== +### February 12, 2016 -- `v2.8.14` +* Audio is now downloaded using the `bestaudio` format. This prevents situations in which some audio would not play because an `.m4a` file was not available (thanks [@mpacella88](https://github.com/mpacella88)). + ### February 6, 2016 -- `v2.8.13` * Added `!version` command to display the version of MumbleDJ that is running (thanks [@zeblau](https://github.com/zeblau)). * Added `version` commandline argument to display the version of MumbleDJ that is running (thanks [@zeblau](https://github.com/zeblau)). From 27c0fc332f068e4187a1f8af897450b57afc6c44 Mon Sep 17 00:00:00 2001 From: Gabriel Plassard Date: Sun, 14 Feb 2016 16:01:48 +0100 Subject: [PATCH 4/6] Display the songtitle when the audio download fails #120 --- service.go | 3 ++- songqueue.go | 2 +- strings.go | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/service.go b/service.go index 02f9da5..1ca7af8 100644 --- a/service.go +++ b/service.go @@ -121,9 +121,10 @@ func FindServiceAndAdd(user *gumble.User, url string) error { if err := dj.queue.CurrentSong().Download(); err == nil { dj.queue.CurrentSong().Play() } else { + var failMessage = fmt.Sprintf(AUDIO_FAIL_MSG, dj.queue.CurrentSong().Title()) dj.queue.CurrentSong().Delete() dj.queue.OnSongFinished() - return errors.New(AUDIO_FAIL_MSG) + return errors.New(failMessage) } } return nil diff --git a/songqueue.go b/songqueue.go index 3fa0539..e723abe 100644 --- a/songqueue.go +++ b/songqueue.go @@ -118,7 +118,7 @@ func (q *SongQueue) PrepareAndPlayNextSong() { if err := q.CurrentSong().Download(); err == nil { q.CurrentSong().Play() } else { - dj.client.Self.Channel.Send(AUDIO_FAIL_MSG, false) + dj.client.Self.Channel.Send(fmt.Sprintf(AUDIO_FAIL_MSG, q.CurrentSong().Title()), false) q.OnSongFinished() } } diff --git a/strings.go b/strings.go index 0d6ea5b..75bce78 100644 --- a/strings.go +++ b/strings.go @@ -60,7 +60,7 @@ const ADMIN_SONG_SKIP_MSG = "An admin has decided to skip the current song." const ADMIN_PLAYLIST_SKIP_MSG = "An admin has decided to skip the current playlist." // Message shown to users when the audio for a video could not be downloaded. -const AUDIO_FAIL_MSG = "The audio download for this video failed. %s has likely not generated the audio files for this %s yet. Skipping to the next song!" +const AUDIO_FAIL_MSG = "The audio download for this video failed. %s has likely not generated the audio files for this track yet. Skipping to the next song!" // Message shown to users when they supply an URL that does not contain a valid ID. const INVALID_ID_MSG = "The %s URL you supplied did not contain a valid ID." From 8a25577bdcf94a3d9b722a59626b3a9a95b857ea Mon Sep 17 00:00:00 2001 From: Matthieu Grieger Date: Sun, 14 Feb 2016 19:57:30 -0800 Subject: [PATCH 5/6] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 752eeec..f60b243 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ MumbleDJ Changelog ================== +### February 14, 2016 -- `v2.8.15` +* Fixed an incorrectly formatted error message (thanks [@GabrielPlassard](https://github.com/GabrielPlassard)). + ### February 12, 2016 -- `v2.8.14` * Audio is now downloaded using the `bestaudio` format. This prevents situations in which some audio would not play because an `.m4a` file was not available (thanks [@mpacella88](https://github.com/mpacella88)). From 6bea261d684caa065da59e6439f96df513171889 Mon Sep 17 00:00:00 2001 From: Matthieu Grieger Date: Sun, 14 Feb 2016 19:57:56 -0800 Subject: [PATCH 6/6] Update version number --- strings.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/strings.go b/strings.go index 75bce78..1a56ec8 100644 --- a/strings.go +++ b/strings.go @@ -8,7 +8,7 @@ package main // Current version of the bot -const VERSION = "v2.8.13" +const VERSION = "v2.8.15" // Message shown to users when they request the version of the bot const DJ_VERSION = "MumbleDJ " + VERSION + ""