mirror of
https://github.com/navidrome/navidrome.git
synced 2025-04-03 20:47:35 +03:00
Remove current Image Cache implementation
This commit is contained in:
parent
c430401ea9
commit
38bde0ddba
6 changed files with 28 additions and 167 deletions
|
@ -40,13 +40,12 @@ 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
|
||||
cacheWarmer core.CacheWarmer
|
||||
broker events.Broker
|
||||
folders map[string]FolderScanner
|
||||
status map[string]*scanStatus
|
||||
lock *sync.RWMutex
|
||||
ds model.DataStore
|
||||
pls core.Playlists
|
||||
broker events.Broker
|
||||
}
|
||||
|
||||
type scanStatus struct {
|
||||
|
@ -56,15 +55,14 @@ type scanStatus struct {
|
|||
lastUpdate time.Time
|
||||
}
|
||||
|
||||
func New(ds model.DataStore, playlists core.Playlists, cacheWarmer core.CacheWarmer, broker events.Broker) Scanner {
|
||||
func New(ds model.DataStore, playlists core.Playlists, broker events.Broker) Scanner {
|
||||
s := &scanner{
|
||||
ds: ds,
|
||||
pls: playlists,
|
||||
cacheWarmer: cacheWarmer,
|
||||
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{},
|
||||
}
|
||||
s.loadFolders()
|
||||
return s
|
||||
|
@ -143,7 +141,6 @@ func (s *scanner) RescanAll(ctx context.Context, fullRescan bool) error {
|
|||
}
|
||||
defer isScanning.Unlock()
|
||||
|
||||
defer s.cacheWarmer.Flush(ctx)
|
||||
var hasError bool
|
||||
for folder := range s.folders {
|
||||
err := s.rescan(ctx, folder, fullRescan)
|
||||
|
@ -245,5 +242,5 @@ func (s *scanner) loadFolders() {
|
|||
}
|
||||
|
||||
func (s *scanner) newScanner(f model.MediaFolder) FolderScanner {
|
||||
return NewTagScanner(f.Path, s.ds, s.pls, s.cacheWarmer)
|
||||
return NewTagScanner(f.Path, s.ds, s.pls)
|
||||
}
|
||||
|
|
|
@ -22,20 +22,18 @@ import (
|
|||
)
|
||||
|
||||
type TagScanner struct {
|
||||
rootFolder string
|
||||
ds model.DataStore
|
||||
cacheWarmer core.CacheWarmer
|
||||
plsSync *playlistImporter
|
||||
cnt *counters
|
||||
mapper *mediaFileMapper
|
||||
rootFolder string
|
||||
ds model.DataStore
|
||||
plsSync *playlistImporter
|
||||
cnt *counters
|
||||
mapper *mediaFileMapper
|
||||
}
|
||||
|
||||
func NewTagScanner(rootFolder string, ds model.DataStore, playlists core.Playlists, cacheWarmer core.CacheWarmer) *TagScanner {
|
||||
func NewTagScanner(rootFolder string, ds model.DataStore, playlists core.Playlists) *TagScanner {
|
||||
return &TagScanner{
|
||||
rootFolder: rootFolder,
|
||||
plsSync: newPlaylistImporter(ds, playlists, rootFolder),
|
||||
ds: ds,
|
||||
cacheWarmer: cacheWarmer,
|
||||
rootFolder: rootFolder,
|
||||
plsSync: newPlaylistImporter(ds, playlists, rootFolder),
|
||||
ds: ds,
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -240,7 +238,6 @@ func (s *TagScanner) processDeletedDir(ctx context.Context, allFSDirs dirMap, di
|
|||
|
||||
for _, t := range mfs {
|
||||
buffer.accumulate(t)
|
||||
s.cacheWarmer.AddAlbum(ctx, t.AlbumID)
|
||||
}
|
||||
|
||||
err = buffer.flush()
|
||||
|
@ -323,11 +320,6 @@ func (s *TagScanner) processChangedDir(ctx context.Context, allFSDirs dirMap, di
|
|||
}
|
||||
}
|
||||
|
||||
// Pre cache all changed album artwork
|
||||
for albumID := range buffer.album {
|
||||
s.cacheWarmer.AddAlbum(ctx, albumID)
|
||||
}
|
||||
|
||||
err = buffer.flush()
|
||||
log.Info(ctx, "Finished processing changed folder", "dir", dir, "updated", numUpdatedTracks,
|
||||
"deleted", numPurgedTracks, "elapsed", time.Since(start))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue