diff --git a/test.go b/test.go index d56813e..fcc1857 100644 --- a/test.go +++ b/test.go @@ -71,9 +71,9 @@ func (t TestSettings) testYoutubeSong() { for url, title := range songs { err := add(dummyUser, url) if err != nil { - fmt.Printf("For: %s; Expected: %s; Got: %s", url, title, err.Error()) + fmt.Printf("For: %s; Expected: %s; Got: %s\n", url, title, err.Error()) } else if dj.queue.CurrentSong().Title() != title { - fmt.Printf("For: %s; Expected: %s; Got: %s", url, title, dj.queue.CurrentSong().Title()) + fmt.Printf("For: %s; Expected: %s; Got: %s\n", url, title, dj.queue.CurrentSong().Title()) } time.Sleep(time.Second * 5) diff --git a/youtube_dl.go b/youtube_dl.go index a661df4..3d6b8ad 100644 --- a/youtube_dl.go +++ b/youtube_dl.go @@ -40,14 +40,16 @@ func (dl *YouTubeDLSong) Download() error { // 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", "--output", fmt.Sprintf(`~/.mumbledj/songs/%s`, dl.Filename()), "--format", "m4a", dl.url) - if err := cmd.Run(); err == nil { + err = cmd.Run() + if err == nil { if dj.conf.Cache.Enabled { dj.cache.CheckMaximumDirectorySize() } return nil + } else { + Verbose("youtube-dl: " + err.Error()) + return errors.New("Song download failed.") } - Verbose("youtube-dl: " + err.Error()) - return errors.New("Song download failed.") } return nil }