🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
Integrate ArtistIndex logic into Artist
Deluanc0beaa6377f3
diff --git a/api/browsing.go b/api/browsing.goindex 6ecc09f99..fa3eae695 100644--- a/api/browsing.go+++ b/api/browsing.go@@ -50,8 +50,8 @@ func (c *BrowsingController) getArtistIndex(r *http.Request, ifModifiedSince timres.Index[i].Name = idx.IDres.Index[i].Artists = make([]responses.Artist, len(idx.Artists))for j, a := range idx.Artists {- res.Index[i].Artists[j].Id = a.ArtistID- res.Index[i].Artists[j].Name = a.Artist+ res.Index[i].Artists[j].Id = a.ID+ res.Index[i].Artists[j].Name = a.Nameres.Index[i].Artists[j].AlbumCount = a.AlbumCount}}diff --git a/engine/browser.go b/engine/browser.goindex 6222b86ab..abdda35c7 100644--- a/engine/browser.go+++ b/engine/browser.go@@ -23,15 +23,14 @@ type Browser interface {GetGenres() (model.Genres, error)}-func NewBrowser(pr model.PropertyRepository, fr model.MediaFolderRepository, ir model.ArtistIndexRepository,+func NewBrowser(pr model.PropertyRepository, fr model.MediaFolderRepository,ar model.ArtistRepository, alr model.AlbumRepository, mr model.MediaFileRepository, gr model.GenreRepository) Browser {- return &browser{pr, fr, ir, ar, alr, mr, gr}+ return &browser{pr, fr, ar, alr, mr, gr}}type browser struct {propRepo model.PropertyRepositoryfolderRepo model.MediaFolderRepository- indexRepo model.ArtistIndexRepositoryartistRepo model.ArtistRepositoryalbumRepo model.AlbumRepositorymfileRepo model.MediaFileRepository@@ -52,7 +51,7 @@ func (b *browser) Indexes(ifModifiedSince time.Time) (model.ArtistIndexes, time.}if lastModified.After(ifModifiedSince) {- indexes, err := b.indexRepo.GetAll()+ indexes, err := b.artistRepo.GetIndex()return indexes, lastModified, err}diff --git a/model/artist.go b/model/artist.goindex 426f670af..59dea872a 100644--- a/model/artist.go+++ b/model/artist.go@@ -5,6 +5,13 @@ type Artist struct {Name stringAlbumCount int}+type Artists []Artist++type ArtistIndex struct {+ ID string+ Artists Artists+}+type ArtistIndexes []ArtistIndextype ArtistRepository interface {CountAll() (int64, error)@@ -14,6 +21,5 @@ type ArtistRepository interface {PurgeInactive(active Artists) errorSearch(q string, offset int, size int) (Artists, error)Refresh(ids ...string) error+ GetIndex() (ArtistIndexes, error)}--type Artists []Artistdiff --git a/model/index.go b/model/index.godeleted file mode 100644index 9ea79a731..000000000--- a/model/index.go+++ /dev/null@@ -1,23 +0,0 @@-package model--type ArtistInfo struct {- ArtistID string- Artist string- AlbumCount int-}--type ArtistIndex struct {- ID string- Artists ArtistInfos-}--type ArtistInfos []ArtistInfo-type ArtistIndexes []ArtistIndex--// TODO Combine ArtistIndex with Artist-type ArtistIndexRepository interface {- Put(m *ArtistIndex) error- Refresh() error- GetAll() (ArtistIndexes, error)- DeleteAll() error-}diff --git a/persistence/artist_repository.go b/persistence/artist_repository.goindex 714a431e2..fe5143e7c 100644--- a/persistence/artist_repository.go+++ b/persistence/artist_repository.go@@ -2,11 +2,14 @@ package persistenceimport ("fmt"+ "sort""strings""github.com/astaxie/beego/orm"+ "github.com/cloudsonic/sonic-server/conf""github.com/cloudsonic/sonic-server/log""github.com/cloudsonic/sonic-server/model"+ "github.com/cloudsonic/sonic-server/utils")type Artist struct {@@ -17,14 +20,27 @@ type Artist struct {type artistRepository struct {searchableRepository+ indexGroups utils.IndexGroups}func NewArtistRepository() model.ArtistRepository {r := &artistRepository{}+ r.indexGroups = utils.ParseIndexGroups(conf.Sonic.IndexGroups)r.tableName = "artist"return r}+func (r *artistRepository) getIndexKey(a *Artist) string {+ name := strings.ToLower(utils.NoArticle(a.Name))+ for k, v := range r.indexGroups {+ key := strings.ToLower(k)+ if strings.HasPrefix(name, key) {+ return v+ }+ }+ return "#"+}+func (r *artistRepository) Put(a *model.Artist) error {ta := Artist(*a)return withTx(func(o orm.Ormer) error {@@ -45,6 +61,34 @@ func (r *artistRepository) Get(id string) (*model.Artist, error) {return &a, nil}+// TODO Cache the index (recalculate when there are changes to the DB)+func (r *artistRepository) GetIndex() (model.ArtistIndexes, error) {+ var all []Artist+ _, err := r.newQuery(Db()).OrderBy("name").All(&all)+ if err != nil {+ return nil, err+ }++ fullIdx := make(map[string]*model.ArtistIndex)+ for _, a := range all {+ ax := r.getIndexKey(&a)+ idx, ok := fullIdx[ax]+ if !ok {+ idx = &model.ArtistIndex{ID: ax}+ fullIdx[ax] = idx+ }+ idx.Artists = append(idx.Artists, model.Artist(a))+ }+ var result model.ArtistIndexes+ for _, idx := range fullIdx {+ result = append(result, *idx)+ }+ sort.Slice(result, func(i, j int) bool {+ return result[i].ID < result[j].ID+ })+ return result, nil+}+func (r *artistRepository) Refresh(ids ...string) error {type refreshArtist struct {Artist@@ -71,17 +115,17 @@ where f.artist_id in ('%s') group by f.artist_id order by f.id`, strings.Join(idvar toInsert []Artistvar toUpdate []Artist- for _, al := range artists {- if al.Compilation {- al.AlbumArtist = "Various Artists"+ for _, ar := range artists {+ if ar.Compilation {+ ar.AlbumArtist = "Various Artists"}- if al.AlbumArtist != "" {- al.Name = al.AlbumArtist+ if ar.AlbumArtist != "" {+ ar.Name = ar.AlbumArtist}- if al.CurrentId != "" {- toUpdate = append(toUpdate, al.Artist)+ if ar.CurrentId != "" {+ toUpdate = append(toUpdate, ar.Artist)} else {- toInsert = append(toInsert, al.Artist)+ toInsert = append(toInsert, ar.Artist)}}if len(toInsert) > 0 {@@ -93,7 +137,7 @@ where f.artist_id in ('%s') group by f.artist_id order by f.id`, strings.Join(id}if len(toUpdate) > 0 {for _, al := range toUpdate {- _, err := o.Update(&al, "name", "album_count")+ _, err := o.Update(&al)if err != nil {return err}diff --git a/persistence/artist_repository_test.go b/persistence/artist_repository_test.goindex b8ef4dd1f..0bd9042df 100644--- a/persistence/artist_repository_test.go+++ b/persistence/artist_repository_test.go@@ -13,18 +13,47 @@ var _ = Describe("ArtistRepository", func() {repo = NewArtistRepository()})- It("saves and retrieves data", func() {- Expect(repo.Get("1")).To(Equal(&model.Artist{ID: "1", Name: "Saara Saara", AlbumCount: 2}))- })+ Describe("Put/Get", func() {+ It("saves and retrieves data", func() {+ Expect(repo.Get("1")).To(Equal(&artistSaaraSaara))+ })++ It("overrides data if ID already exists", func() {+ Expect(repo.Put(&model.Artist{ID: "1", Name: "Saara Saara is The Best!", AlbumCount: 3})).To(BeNil())+ Expect(repo.Get("1")).To(Equal(&model.Artist{ID: "1", Name: "Saara Saara is The Best!", AlbumCount: 3}))+ })- It("overrides data if ID already exists", func() {- Expect(repo.Put(&model.Artist{ID: "1", Name: "Saara Saara is The Best!", AlbumCount: 3})).To(BeNil())- Expect(repo.Get("1")).To(Equal(&model.Artist{ID: "1", Name: "Saara Saara is The Best!", AlbumCount: 3}))+ It("returns ErrNotFound when the ID does not exist", func() {+ _, err := repo.Get("999")+ Expect(err).To(MatchError(model.ErrNotFound))+ })})- It("returns ErrNotFound when the ID does not exist", func() {- _, err := repo.Get("999")- Expect(err).To(MatchError(model.ErrNotFound))+ Describe("GetIndex", func() {+ It("returns the index", func() {+ idx, err := repo.GetIndex()+ Expect(err).To(BeNil())+ Expect(idx).To(Equal(model.ArtistIndexes{+ {+ ID: "B",+ Artists: model.Artists{+ artistBeatles,+ },+ },+ {+ ID: "K",+ Artists: model.Artists{+ artistKraftwerk,+ },+ },+ {+ ID: "S",+ Artists: model.Artists{+ {ID: "1", Name: "Saara Saara is The Best!", AlbumCount: 3},+ },+ },+ }))+ })})Describe("PurgeInactive", func() {diff --git a/persistence/index_repository.go b/persistence/index_repository.godeleted file mode 100644index 1ba8a4f2b..000000000--- a/persistence/index_repository.go+++ /dev/null@@ -1,145 +0,0 @@-package persistence--import (- "sort"- "strings"-- "github.com/astaxie/beego/orm"- "github.com/cloudsonic/sonic-server/conf"- "github.com/cloudsonic/sonic-server/model"- "github.com/cloudsonic/sonic-server/utils"-)--type ArtistInfo struct {- ID int `orm:"pk;auto;column(id)"`- Idx string- ArtistID string `orm:"column(artist_id)"`- Artist string- AlbumCount int-}--type tempIndex map[string]model.ArtistInfo--type artistIndexRepository struct {- sqlRepository-}--func NewArtistIndexRepository() model.ArtistIndexRepository {- r := &artistIndexRepository{}- r.tableName = "artist_info"- return r-}--func (r *artistIndexRepository) Put(idx *model.ArtistIndex) error {- return withTx(func(o orm.Ormer) error {- _, err := r.newQuery(o).Filter("idx", idx.ID).Delete()- if err != nil {- return err- }- for _, artist := range idx.Artists {- a := ArtistInfo{- Idx: idx.ID,- ArtistID: artist.ArtistID,- Artist: artist.Artist,- AlbumCount: artist.AlbumCount,- }- err := r.insert(o, &a)- if err != nil {- return err- }- }- return nil- })-}--func (r *artistIndexRepository) Refresh() error {- o := Db()-- indexGroups := utils.ParseIndexGroups(conf.Sonic.IndexGroups)- artistIndex := make(map[string]tempIndex)-- var artists []Artist- _, err := o.QueryTable(&Artist{}).All(&artists)- if err != nil {- return err- }-- for _, ar := range artists {- r.collectIndex(indexGroups, &ar, artistIndex)- }-- return r.saveIndex(artistIndex)-}--func (r *artistIndexRepository) collectIndex(ig utils.IndexGroups, a *Artist, artistIndex map[string]tempIndex) {- name := a.Name- indexName := strings.ToLower(utils.NoArticle(name))- if indexName == "" {- return- }- group := r.findGroup(ig, indexName)- artists := artistIndex[group]- if artists == nil {- artists = make(tempIndex)- artistIndex[group] = artists- }- artists[indexName] = model.ArtistInfo{ArtistID: a.ID, Artist: a.Name, AlbumCount: a.AlbumCount}-}--func (r *artistIndexRepository) findGroup(ig utils.IndexGroups, name string) string {- for k, v := range ig {- key := strings.ToLower(k)- if strings.HasPrefix(name, key) {- return v- }- }- return "#"-}--func (r *artistIndexRepository) saveIndex(artistIndex map[string]tempIndex) error {- r.DeleteAll()- for k, temp := range artistIndex {- idx := &model.ArtistIndex{ID: k}- for _, v := range temp {- idx.Artists = append(idx.Artists, v)- }- err := r.Put(idx)- if err != nil {- return err- }- }-- return nil-}--func (r *artistIndexRepository) GetAll() (model.ArtistIndexes, error) {- var all []ArtistInfo- _, err := r.newQuery(Db()).OrderBy("idx", "artist").All(&all)- if err != nil {- return nil, err- }-- fullIdx := make(map[string]*model.ArtistIndex)- for _, a := range all {- idx, ok := fullIdx[a.Idx]- if !ok {- idx = &model.ArtistIndex{ID: a.Idx}- fullIdx[a.Idx] = idx- }- idx.Artists = append(idx.Artists, model.ArtistInfo{- ArtistID: a.ArtistID,- Artist: a.Artist,- AlbumCount: a.AlbumCount,- })- }- var result model.ArtistIndexes- for _, idx := range fullIdx {- result = append(result, *idx)- }- sort.Slice(result, func(i, j int) bool {- return result[i].ID < result[j].ID- })- return result, nil-}--var _ model.ArtistIndexRepository = (*artistIndexRepository)(nil)diff --git a/persistence/index_repository_test.go b/persistence/index_repository_test.godeleted file mode 100644index f53660e6a..000000000--- a/persistence/index_repository_test.go+++ /dev/null@@ -1,40 +0,0 @@-package persistence--import (- "github.com/cloudsonic/sonic-server/model"- . "github.com/onsi/ginkgo"- . "github.com/onsi/gomega"-)--var _ = Describe("Artist Index", func() {- var repo model.ArtistIndexRepository-- BeforeEach(func() {- repo = NewArtistIndexRepository()- err := repo.DeleteAll()- if err != nil {- panic(err)- }- })-- It("successfully persists data", func() {- idx1 := model.ArtistIndex{- ID: "D",- Artists: model.ArtistInfos{- {ArtistID: "4", Artist: "Doobie Brothers", AlbumCount: 2},- {ArtistID: "3", Artist: "The Doors", AlbumCount: 5},- },- }- idx2 := model.ArtistIndex{- ID: "S",- Artists: model.ArtistInfos{- {ArtistID: "1", Artist: "Saara Saara", AlbumCount: 3},- {ArtistID: "2", Artist: "Seu Jorge", AlbumCount: 1},- },- }-- Expect(repo.Put(&idx1)).To(BeNil())- Expect(repo.Put(&idx2)).To(BeNil())- Expect(repo.GetAll()).To(Equal(model.ArtistIndexes{idx1, idx2}))- })-})diff --git a/persistence/mock_index_repo.go b/persistence/mock_index_repo.godeleted file mode 100644index 303cb752a..000000000--- a/persistence/mock_index_repo.go+++ /dev/null@@ -1,40 +0,0 @@-package persistence--import (- "encoding/json"- "errors"- "fmt"-- "github.com/cloudsonic/sonic-server/model"-)--func CreateMockArtistIndexRepo() *MockArtistIndex {- return &MockArtistIndex{}-}--type MockArtistIndex struct {- model.ArtistIndexRepository- data model.ArtistIndexes- err bool-}--func (m *MockArtistIndex) SetError(err bool) {- m.err = err-}--func (m *MockArtistIndex) SetData(j string, length int) {- m.data = make(model.ArtistIndexes, length)- err := json.Unmarshal([]byte(j), &m.data)- if err != nil {- fmt.Println("ERROR: ", err)- }-}--func (m *MockArtistIndex) GetAll() (model.ArtistIndexes, error) {- if m.err {- return nil, errors.New("Error!")- }- return m.data, nil-}--var _ model.ArtistIndexRepository = (*MockArtistIndex)(nil)diff --git a/persistence/persistence.go b/persistence/persistence.goindex 6e7ce7598..d196839c1 100644--- a/persistence/persistence.go+++ b/persistence/persistence.go@@ -74,7 +74,6 @@ func initORM(dbPath string) error {orm.RegisterModel(new(Artist))orm.RegisterModel(new(Album))orm.RegisterModel(new(MediaFile))- orm.RegisterModel(new(ArtistInfo))orm.RegisterModel(new(Checksum))orm.RegisterModel(new(Property))orm.RegisterModel(new(Playlist))diff --git a/persistence/wire_provider.go b/persistence/wire_provider.goindex 2390b983c..e782184d5 100644--- a/persistence/wire_provider.go+++ b/persistence/wire_provider.go@@ -8,7 +8,6 @@ var Set = wire.NewSet(NewArtistRepository,NewMediaFileRepository,NewAlbumRepository,- NewArtistIndexRepository,NewCheckSumRepository,NewPropertyRepository,NewPlaylistRepository,diff --git a/scanner/scanner.go b/scanner/scanner.goindex ef0156cda..15099d09b 100644--- a/scanner/scanner.go+++ b/scanner/scanner.go@@ -21,18 +21,16 @@ type Repositories struct {mediaFile model.MediaFileRepositoryalbum model.AlbumRepositoryartist model.ArtistRepository- index model.ArtistIndexRepositoryplaylist model.PlaylistRepositoryproperty model.PropertyRepository}-func New(mfRepo model.MediaFileRepository, albumRepo model.AlbumRepository, artistRepo model.ArtistRepository, idxRepo model.ArtistIndexRepository, plsRepo model.PlaylistRepository, folderRepo model.MediaFolderRepository, property model.PropertyRepository) *Scanner {+func New(mfRepo model.MediaFileRepository, albumRepo model.AlbumRepository, artistRepo model.ArtistRepository, plsRepo model.PlaylistRepository, folderRepo model.MediaFolderRepository, property model.PropertyRepository) *Scanner {repos := Repositories{folder: folderRepo,mediaFile: mfRepo,album: albumRepo,artist: artistRepo,- index: idxRepo,playlist: plsRepo,property: property,}diff --git a/scanner/scanner_suite_test.go b/scanner/scanner_suite_test.goindex 9d216f9fc..d260a62c6 100644--- a/scanner/scanner_suite_test.go+++ b/scanner/scanner_suite_test.go@@ -25,7 +25,6 @@ var _ = XDescribe("TODO: REMOVE", func() {mediaFile: persistence.NewMediaFileRepository(),album: persistence.NewAlbumRepository(),artist: persistence.NewArtistRepository(),- index: persistence.NewArtistIndexRepository(),playlist: nil,}It("WORKS!", func() {diff --git a/scanner/tag_scanner.go b/scanner/tag_scanner.goindex 41ff9ced9..714738d8a 100644--- a/scanner/tag_scanner.go+++ b/scanner/tag_scanner.go@@ -79,11 +79,6 @@ func (s *TagScanner) Scan(ctx context.Context, lastModifiedSince time.Time) erroreturn err}- err = s.repos.index.Refresh()- if err != nil {- return err- }-return nil}diff --git a/scanner_legacy/importer.go b/scanner_legacy/importer.goindex 66f8dc52c..976794384 100644--- a/scanner_legacy/importer.go+++ b/scanner_legacy/importer.go@@ -4,13 +4,11 @@ import ("fmt""os""strconv"- "strings""time""github.com/cloudsonic/sonic-server/conf""github.com/cloudsonic/sonic-server/log""github.com/cloudsonic/sonic-server/model"- "github.com/cloudsonic/sonic-server/utils")type Scanner interface {@@ -21,29 +19,25 @@ type Scanner interface {Playlists() map[string]*model.Playlist}-type tempIndex map[string]model.ArtistInfo-type Importer struct {scanner ScannermediaFolder stringmfRepo model.MediaFileRepositoryalbumRepo model.AlbumRepositoryartistRepo model.ArtistRepository- idxRepo model.ArtistIndexRepositoryplsRepo model.PlaylistRepositorypropertyRepo model.PropertyRepositorylastScan time.TimelastCheck time.Time}-func NewImporter(mediaFolder string, scanner Scanner, mfRepo model.MediaFileRepository, albumRepo model.AlbumRepository, artistRepo model.ArtistRepository, idxRepo model.ArtistIndexRepository, plsRepo model.PlaylistRepository, propertyRepo model.PropertyRepository) *Importer {+func NewImporter(mediaFolder string, scanner Scanner, mfRepo model.MediaFileRepository, albumRepo model.AlbumRepository, artistRepo model.ArtistRepository, plsRepo model.PlaylistRepository, propertyRepo model.PropertyRepository) *Importer {return &Importer{scanner: scanner,mediaFolder: mediaFolder,mfRepo: mfRepo,albumRepo: albumRepo,artistRepo: artistRepo,- idxRepo: idxRepo,plsRepo: plsRepo,propertyRepo: propertyRepo,}@@ -131,7 +125,6 @@ func (i *Importer) importLibrary() (err error) {log.Debug("Imported artists", "total", len(ars))pls := i.importPlaylists()log.Debug("Imported playlists", "total", len(pls))- i.importArtistIndex()log.Debug("Purging old data")if err := i.mfRepo.PurgeInactive(mfs); err != nil {@@ -239,19 +232,6 @@ func (i *Importer) importArtists() model.Artists {return ars}-func (i *Importer) importArtistIndex() {- indexGroups := utils.ParseIndexGroups(conf.Sonic.IndexGroups)- artistIndex := make(map[string]tempIndex)-- for _, ar := range i.scanner.Artists() {- i.collectIndex(indexGroups, ar, artistIndex)- }-- if err := i.saveIndex(artistIndex); err != nil {- log.Error(err)- }-}-func (i *Importer) importPlaylists() model.Playlists {pls := make(model.Playlists, len(i.scanner.Playlists()))j := 0@@ -267,44 +247,3 @@ func (i *Importer) importPlaylists() model.Playlists {}return pls}--func (i *Importer) collectIndex(ig utils.IndexGroups, a *model.Artist, artistIndex map[string]tempIndex) {- name := a.Name- indexName := strings.ToLower(utils.NoArticle(name))- if indexName == "" {- return- }- group := i.findGroup(ig, indexName)- artists := artistIndex[group]- if artists == nil {- artists = make(tempIndex)- artistIndex[group] = artists- }- artists[indexName] = model.ArtistInfo{ArtistID: a.ID, Artist: a.Name, AlbumCount: a.AlbumCount}-}--func (i *Importer) findGroup(ig utils.IndexGroups, name string) string {- for k, v := range ig {- key := strings.ToLower(k)- if strings.HasPrefix(name, key) {- return v- }- }- return "#"-}--func (i *Importer) saveIndex(artistIndex map[string]tempIndex) error {- i.idxRepo.DeleteAll()- for k, temp := range artistIndex {- idx := &model.ArtistIndex{ID: k}- for _, v := range temp {- idx.Artists = append(idx.Artists, v)- }- err := i.idxRepo.Put(idx)- if err != nil {- return err- }- }-- return nil-}diff --git a/scanner_legacy/importer_test.go b/scanner_legacy/importer_test.godeleted file mode 100644index 59a32261f..000000000--- a/scanner_legacy/importer_test.go+++ /dev/null@@ -1,74 +0,0 @@-package scanner_legacy--import (- "testing"-- "github.com/cloudsonic/sonic-server/model"- "github.com/cloudsonic/sonic-server/tests"- "github.com/cloudsonic/sonic-server/utils"- . "github.com/smartystreets/goconvey/convey"-)--func TestCollectIndex(t *testing.T) {- tests.Init(t, false)-- ig := utils.IndexGroups{"A": "A", "B": "B", "Tom": "Tom", "X": "X-Z"}-- importer := &Importer{}-- Convey("Simple Name", t, func() {- a := &model.Artist{Name: "Björk"}- artistIndex := make(map[string]tempIndex)-- importer.collectIndex(ig, a, artistIndex)-- So(artistIndex, ShouldContainKey, "B")- So(artistIndex["B"], ShouldContainKey, "björk")-- for _, k := range []string{"A", "Tom", "X-Z", "#"} {- So(artistIndex, ShouldNotContainKey, k)- }- })-- Convey("Name not in the index", t, func() {- a := &model.Artist{Name: "Kraftwerk"}- artistIndex := make(map[string]tempIndex)-- importer.collectIndex(ig, a, artistIndex)-- So(artistIndex, ShouldContainKey, "#")- So(artistIndex["#"], ShouldContainKey, "kraftwerk")-- for _, k := range []string{"A", "B", "Tom", "X-Z"} {- So(artistIndex, ShouldNotContainKey, k)- }- })-- Convey("Name starts with an article", t, func() {- a := &model.Artist{Name: "The The"}- artistIndex := make(map[string]tempIndex)-- importer.collectIndex(ig, a, artistIndex)-- So(artistIndex, ShouldContainKey, "#")- So(artistIndex["#"], ShouldContainKey, "the")-- for _, k := range []string{"A", "B", "Tom", "X-Z"} {- So(artistIndex, ShouldNotContainKey, k)- }- })-- Convey("Name match a multichar entry", t, func() {- a := &model.Artist{Name: "Tom Waits"}- artistIndex := make(map[string]tempIndex)-- importer.collectIndex(ig, a, artistIndex)-- So(artistIndex, ShouldContainKey, "Tom")- So(artistIndex["Tom"], ShouldContainKey, "tom waits")-- for _, k := range []string{"A", "B", "X-Z", "#"} {- So(artistIndex, ShouldNotContainKey, k)- }- })-}diff --git a/wire_gen.go b/wire_gen.goindex 2ae264030..60f051679 100644--- a/wire_gen.go+++ b/wire_gen.go@@ -24,12 +24,11 @@ func CreateApp(musicFolder string) *server.Server {mediaFileRepository := persistence.NewMediaFileRepository()albumRepository := persistence.NewAlbumRepository()artistRepository := persistence.NewArtistRepository()- artistIndexRepository := persistence.NewArtistIndexRepository()playlistRepository := persistence.NewPlaylistRepository()propertyRepository := persistence.NewPropertyRepository()- importer := scanner_legacy.NewImporter(musicFolder, itunesScanner, mediaFileRepository, albumRepository, artistRepository, artistIndexRepository, playlistRepository, propertyRepository)+ importer := scanner_legacy.NewImporter(musicFolder, itunesScanner, mediaFileRepository, albumRepository, artistRepository, playlistRepository, propertyRepository)mediaFolderRepository := persistence.NewMediaFolderRepository()- scannerScanner := scanner.New(mediaFileRepository, albumRepository, artistRepository, artistIndexRepository, playlistRepository, mediaFolderRepository, propertyRepository)+ scannerScanner := scanner.New(mediaFileRepository, albumRepository, artistRepository, playlistRepository, mediaFolderRepository, propertyRepository)serverServer := server.New(importer, scannerScanner)return serverServer}@@ -37,12 +36,11 @@ func CreateApp(musicFolder string) *server.Server {func CreateSubsonicAPIRouter() *api.Router {propertyRepository := persistence.NewPropertyRepository()mediaFolderRepository := persistence.NewMediaFolderRepository()- artistIndexRepository := persistence.NewArtistIndexRepository()artistRepository := persistence.NewArtistRepository()albumRepository := persistence.NewAlbumRepository()mediaFileRepository := persistence.NewMediaFileRepository()genreRepository := persistence.NewGenreRepository()- browser := engine.NewBrowser(propertyRepository, mediaFolderRepository, artistIndexRepository, artistRepository, albumRepository, mediaFileRepository, genreRepository)+ browser := engine.NewBrowser(propertyRepository, mediaFolderRepository, artistRepository, albumRepository, mediaFileRepository, genreRepository)cover := engine.NewCover(mediaFileRepository, albumRepository)nowPlayingRepository := persistence.NewNowPlayingRepository()listGenerator := engine.NewListGenerator(albumRepository, mediaFileRepository, nowPlayingRepository)