Fix https://github.com/matthieugrieger/mumbledj/issues/46: Download fail on songs with "-" at beginning of ID

This commit is contained in:
Matthieu Grieger 2015-02-20 11:02:23 -08:00
parent ca558ffdd6
commit 85a57feb14
2 changed files with 4 additions and 1 deletions

View file

@ -1,6 +1,9 @@
MumbleDJ Changelog
==================
### February 20, 2015 -- `v2.6.4`
* Fixed failed audio downloads for YouTube videos with IDs beginning with "-".
### February 19, 2015 -- `v2.6.3`
* Added `gumbleutil.CertificateLockFile()` for more secure connections.
* Added `-insecure` boolean commandline flag to allow MumbleDJ to connect to a server without overwriting `~/.mumbledj/cert.lock`.

View file

@ -80,7 +80,7 @@ func NewSong(user, id string, playlist *Playlist) (*Song, error) {
// All downloaded songs are stored in ~/.mumbledj/songs and should be automatically cleaned.
func (s *Song) Download() error {
if _, err := os.Stat(fmt.Sprintf("%s/.mumbledj/songs/%s.m4a", dj.homeDir, s.youtubeId)); os.IsNotExist(err) {
cmd := exec.Command("youtube-dl", "--output", fmt.Sprintf(`~/.mumbledj/songs/%s.m4a`, s.youtubeId), "--format", "m4a", s.youtubeId)
cmd := exec.Command("youtube-dl", "--output", fmt.Sprintf(`~/.mumbledj/songs/%s.m4a`, s.youtubeId), "--format", "m4a", "--", s.youtubeId)
if err := cmd.Run(); err == nil {
if dj.conf.Cache.Enabled {
dj.cache.CheckMaximumDirectorySize()