Add new Artwork Cache Warmer

This commit is contained in:
Deluan 2022-12-23 12:28:22 -05:00 committed by Deluan Quintão
parent 8c1cd9c273
commit b6eb60f019
11 changed files with 501 additions and 215 deletions

View file

@ -40,12 +40,13 @@ type FolderScanner interface {
var isScanning sync.Mutex
type scanner struct {
folders map[string]FolderScanner
status map[string]*scanStatus
lock *sync.RWMutex
ds model.DataStore
pls core.Playlists
broker events.Broker
folders map[string]FolderScanner
status map[string]*scanStatus
lock *sync.RWMutex
ds model.DataStore
pls core.Playlists
broker events.Broker
cacheWarmer core.ArtworkCacheWarmer
}
type scanStatus struct {
@ -55,14 +56,15 @@ type scanStatus struct {
lastUpdate time.Time
}
func New(ds model.DataStore, playlists core.Playlists, broker events.Broker) Scanner {
func New(ds model.DataStore, playlists core.Playlists, cacheWarmer core.ArtworkCacheWarmer, broker events.Broker) Scanner {
s := &scanner{
ds: ds,
pls: playlists,
broker: broker,
folders: map[string]FolderScanner{},
status: map[string]*scanStatus{},
lock: &sync.RWMutex{},
ds: ds,
pls: playlists,
broker: broker,
folders: map[string]FolderScanner{},
status: map[string]*scanStatus{},
lock: &sync.RWMutex{},
cacheWarmer: cacheWarmer,
}
s.loadFolders()
return s
@ -242,5 +244,5 @@ func (s *scanner) loadFolders() {
}
func (s *scanner) newScanner(f model.MediaFolder) FolderScanner {
return NewTagScanner(f.Path, s.ds, s.pls)
return NewTagScanner(f.Path, s.ds, s.pls, s.cacheWarmer)
}