Precaching

This commit is contained in:
MichaelOultram 2015-07-28 13:43:43 +01:00
parent 6858011bc0
commit d62cdc70da

View file

@ -30,6 +30,12 @@ func (q *SongQueue) AddSong(s Song) error {
beforeLen := q.Len()
q.queue = append(q.queue, s)
if len(q.queue) == beforeLen+1 {
// Caching as added to queue
if dj.conf.Cache.Enabled && c.GetCurrentTotalFileSize() > (dj.conf.Cache.MaximumSize*1048576) {
s.Download()
}
return nil
}
return errors.New("Could not add Song to the SongQueue.")