Added getSong.view

This commit is contained in:
Deluan 2016-03-25 00:04:22 -04:00
parent 06828d8738
commit ee8e9864ea
4 changed files with 32 additions and 2 deletions

View file

@ -15,6 +15,7 @@ type Browser interface {
MediaFolders() (domain.MediaFolders, error)
Indexes(ifModifiedSince time.Time) (domain.ArtistIndexes, time.Time, error)
Directory(id string) (*DirectoryInfo, error)
GetSong(id string) (*Entry, error)
}
func NewBrowser(pr PropertyRepository, fr domain.MediaFolderRepository, ir domain.ArtistIndexRepository,
@ -87,6 +88,16 @@ func (b *browser) Directory(id string) (*DirectoryInfo, error) {
return dir, nil
}
func (b *browser) GetSong(id string) (*Entry, error) {
mf, err := b.mfileRepo.Get(id)
if err != nil {
return nil, err
}
entry := FromMediaFile(mf)
return &entry, nil
}
func (b *browser) buildArtistDir(a *domain.Artist, albums domain.Albums) *DirectoryInfo {
dir := &DirectoryInfo{Id: a.Id, Name: a.Name}