Implemented artists indexing, with Gomate

This commit is contained in:
Deluan
2016-03-10 23:19:13 -05:00
parent 7c75084249
commit df957814a0
9 changed files with 79 additions and 26 deletions
+29
View File
@@ -0,0 +1,29 @@
package engine
import (
"strings"
"github.com/deluan/gomate"
"github.com/deluan/gosonic/domain"
)
type Search interface {
IndexArtist(ar *domain.Artist) error
//IndexAlbum(al domain.Album) error
//IndexMediaFile(mf domain.MediaFile) error
}
type search struct {
artistRepo domain.ArtistRepository
albumRepo domain.AlbumRepository
mfileRepo domain.MediaFileRepository
indexer gomate.Indexer
}
func NewSearch(ar domain.ArtistRepository, alr domain.AlbumRepository, mr domain.MediaFileRepository, idx gomate.Indexer) Search {
return search{ar, alr, mr, idx}
}
func (s search) IndexArtist(ar *domain.Artist) error {
return s.indexer.Index(ar.Id, strings.ToLower(ar.Name))
}