Skip to content
This repository has been archived by the owner on Jan 20, 2021. It is now read-only.

Commit

Permalink
Fixed player command setting not being applied to youtube-dl calls
Browse files Browse the repository at this point in the history
  • Loading branch information
matthieugrieger committed May 24, 2016
1 parent 7e9b6fb commit e133c0e
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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)).

Expand Down
2 changes: 1 addition & 1 deletion strings.go
Original file line number Diff line number Diff line change
Expand Up @@ -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>"
Expand Down
6 changes: 5 additions & 1 deletion youtube_dl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit e133c0e

Please sign in to comment.