Make private types unexported
This commit is contained in:
+10
-10
@@ -35,8 +35,8 @@ func NewTagScanner(rootFolder string, ds model.DataStore) *TagScanner {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type (
|
type (
|
||||||
ArtistMap map[string]struct{}
|
artistMap map[string]struct{}
|
||||||
AlbumMap map[string]struct{}
|
albumMap map[string]struct{}
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@@ -81,8 +81,8 @@ func (s *TagScanner) Scan(ctx context.Context, lastModifiedSince time.Time) erro
|
|||||||
sort.Strings(changed)
|
sort.Strings(changed)
|
||||||
sort.Strings(deleted)
|
sort.Strings(deleted)
|
||||||
|
|
||||||
updatedArtists := ArtistMap{}
|
updatedArtists := artistMap{}
|
||||||
updatedAlbums := AlbumMap{}
|
updatedAlbums := albumMap{}
|
||||||
|
|
||||||
for _, c := range changed {
|
for _, c := range changed {
|
||||||
err := s.processChangedDir(ctx, c, updatedArtists, updatedAlbums)
|
err := s.processChangedDir(ctx, c, updatedArtists, updatedAlbums)
|
||||||
@@ -117,7 +117,7 @@ func (s *TagScanner) Scan(ctx context.Context, lastModifiedSince time.Time) erro
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TagScanner) flushAlbums(ctx context.Context, updatedAlbums AlbumMap) error {
|
func (s *TagScanner) flushAlbums(ctx context.Context, updatedAlbums albumMap) error {
|
||||||
if len(updatedAlbums) == 0 {
|
if len(updatedAlbums) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -129,7 +129,7 @@ func (s *TagScanner) flushAlbums(ctx context.Context, updatedAlbums AlbumMap) er
|
|||||||
return s.ds.Album(ctx).Refresh(ids...)
|
return s.ds.Album(ctx).Refresh(ids...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TagScanner) flushArtists(ctx context.Context, updatedArtists ArtistMap) error {
|
func (s *TagScanner) flushArtists(ctx context.Context, updatedArtists artistMap) error {
|
||||||
if len(updatedArtists) == 0 {
|
if len(updatedArtists) == 0 {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
@@ -141,7 +141,7 @@ func (s *TagScanner) flushArtists(ctx context.Context, updatedArtists ArtistMap)
|
|||||||
return s.ds.Artist(ctx).Refresh(ids...)
|
return s.ds.Artist(ctx).Refresh(ids...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TagScanner) processChangedDir(ctx context.Context, dir string, updatedArtists ArtistMap, updatedAlbums AlbumMap) error {
|
func (s *TagScanner) processChangedDir(ctx context.Context, dir string, updatedArtists artistMap, updatedAlbums albumMap) error {
|
||||||
dir = filepath.Join(s.rootFolder, dir)
|
dir = filepath.Join(s.rootFolder, dir)
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
@@ -245,7 +245,7 @@ func (s *TagScanner) processChangedDir(ctx context.Context, dir string, updatedA
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TagScanner) updateAlbum(ctx context.Context, albumId string, updatedAlbums AlbumMap) error {
|
func (s *TagScanner) updateAlbum(ctx context.Context, albumId string, updatedAlbums albumMap) error {
|
||||||
updatedAlbums[albumId] = struct{}{}
|
updatedAlbums[albumId] = struct{}{}
|
||||||
if len(updatedAlbums) >= batchSize {
|
if len(updatedAlbums) >= batchSize {
|
||||||
err := s.flushAlbums(ctx, updatedAlbums)
|
err := s.flushAlbums(ctx, updatedAlbums)
|
||||||
@@ -256,7 +256,7 @@ func (s *TagScanner) updateAlbum(ctx context.Context, albumId string, updatedAlb
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TagScanner) updateArtist(ctx context.Context, artistId string, updatedArtists ArtistMap) error {
|
func (s *TagScanner) updateArtist(ctx context.Context, artistId string, updatedArtists artistMap) error {
|
||||||
updatedArtists[artistId] = struct{}{}
|
updatedArtists[artistId] = struct{}{}
|
||||||
if len(updatedArtists) >= batchSize {
|
if len(updatedArtists) >= batchSize {
|
||||||
err := s.flushArtists(ctx, updatedArtists)
|
err := s.flushArtists(ctx, updatedArtists)
|
||||||
@@ -267,7 +267,7 @@ func (s *TagScanner) updateArtist(ctx context.Context, artistId string, updatedA
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *TagScanner) processDeletedDir(ctx context.Context, dir string, updatedArtists ArtistMap, updatedAlbums AlbumMap) error {
|
func (s *TagScanner) processDeletedDir(ctx context.Context, dir string, updatedArtists artistMap, updatedAlbums albumMap) error {
|
||||||
dir = filepath.Join(s.rootFolder, dir)
|
dir = filepath.Join(s.rootFolder, dir)
|
||||||
start := time.Now()
|
start := time.Now()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user