Fixed player command setting not being applied to youtube-dl calls

This commit is contained in:
Matthieu Grieger 2016-05-24 11:34:17 -07:00
parent 7e9b6fb10e
commit e133c0efcb
3 changed files with 9 additions and 2 deletions

View file

@ -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)).

View file

@ -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 <b>" + VERSION + "</b>"

View file

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