From 2df36136361c1942e21b5517b1162f73b0c4f124 Mon Sep 17 00:00:00 2001 From: Connor Mahaffey Date: Wed, 12 Aug 2015 11:46:09 -0400 Subject: [PATCH 1/2] Fixed cache clearing earlier than expected By default, the date on a file downloaded by youtube-dl is the date the video was originally uploaded to youtube. As a result, items will always be cleared from the cache because they appear to be years old - even though they were just downloaded. Adding the directive "--no-mtime" will make the date on files the date the file was downloaded. See this issue on youtube-dl: https://github.com/rg3/youtube-dl/issues/4667 --- service_youtube.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/service_youtube.go b/service_youtube.go index b93b30a..450c2f0 100644 --- a/service_youtube.go +++ b/service_youtube.go @@ -140,7 +140,7 @@ func NewYouTubeSong(user, id, offset string, playlist *YouTubePlaylist) (*YouTub // All downloaded songs are stored in ~/.mumbledj/songs and should be automatically cleaned. func (s *YouTubeSong) Download() error { if _, err := os.Stat(fmt.Sprintf("%s/.mumbledj/songs/%s", dj.homeDir, s.Filename())); os.IsNotExist(err) { - cmd := exec.Command("youtube-dl", "--output", fmt.Sprintf(`~/.mumbledj/songs/%s`, s.Filename()), "--format", "m4a", "--", s.ID()) + cmd := exec.Command("youtube-dl", "--no-mtime", "--output", fmt.Sprintf(`~/.mumbledj/songs/%s`, s.Filename()), "--format", "m4a", "--", s.ID()) if err := cmd.Run(); err == nil { if dj.conf.Cache.Enabled { dj.cache.CheckMaximumDirectorySize() From 9928986bfe38df365c536db3f3206bcd9162fe83 Mon Sep 17 00:00:00 2001 From: Matthieu Grieger Date: Wed, 12 Aug 2015 21:24:41 -0700 Subject: [PATCH 2/2] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index ac1421a..2493d8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ MumbleDJ Changelog ================== +### August 12, 2015 -- `v2.7.5` +* Fixed cache clearing earlier than expected (thanks [@CMahaff](https://github.com/CMahaff)). + ### May 19, 2015 -- `v2.7.4` * Fixed a panic that occurred when certain YouTube playlists were added to the queue.