Precaching
This commit is contained in:
parent
6858011bc0
commit
d62cdc70da
|
@ -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.")
|
||||
|
|
Reference in a new issue