From e133c0efcb48e8568dd842622955476ffdac7ec9 Mon Sep 17 00:00:00 2001 From: Matthieu Grieger Date: Tue, 24 May 2016 11:34:17 -0700 Subject: [PATCH] Fixed player command setting not being applied to youtube-dl calls --- CHANGELOG.md | 3 +++ strings.go | 2 +- youtube_dl.go | 6 +++++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f45cc2e..75f360b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ MumbleDJ Changelog ================== +### May 24, 2016 -- `v2.9.1` +* Fixed player command configuration setting not being applied to youtube-dl calls. + ### April 9, 2016 -- `v2.9.0` * Added support for Mixcloud (thanks [@benklett](https://github.com/benklett)). diff --git a/strings.go b/strings.go index ed853a5..17e50dd 100644 --- a/strings.go +++ b/strings.go @@ -8,7 +8,7 @@ package main // Current version of the bot -const VERSION = "v2.9.0" +const VERSION = "v2.9.1" // Message shown to users when they request the version of the bot const DJ_VERSION = "MumbleDJ " + VERSION + "" diff --git a/youtube_dl.go b/youtube_dl.go index ff39510..524143b 100644 --- a/youtube_dl.go +++ b/youtube_dl.go @@ -53,10 +53,14 @@ type AudioPlaylist struct { // Download downloads the song via youtube-dl if it does not already exist on disk. // All downloaded songs are stored in ~/.mumbledj/songs and should be automatically cleaned. func (dl *AudioTrack) Download() error { + player := "--prefer-ffmpeg" + if dj.conf.General.PlayerCommand == "avconv" { + player = "--prefer-avconv" + } // Checks to see if song is already downloaded if _, err := os.Stat(fmt.Sprintf("%s/.mumbledj/songs/%s", dj.homeDir, dl.Filename())); os.IsNotExist(err) { - cmd := exec.Command("youtube-dl", "--verbose", "--no-mtime", "--output", fmt.Sprintf("%s/.mumbledj/songs/%s", dj.homeDir, dl.Filename()), "--format", dl.format, "--prefer-ffmpeg", dl.url) + cmd := exec.Command("youtube-dl", "--verbose", "--no-mtime", "--output", fmt.Sprintf("%s/.mumbledj/songs/%s", dj.homeDir, dl.Filename()), "--format", dl.format, player, dl.url) output, err := cmd.CombinedOutput() if err == nil { if dj.conf.Cache.Enabled {