Using Entries instead of []Entry
This commit is contained in:
+3
-3
@@ -56,7 +56,7 @@ func (b browser) Indexes(ifModifiedSince time.Time) (*domain.ArtistIndexes, time
|
|||||||
type DirectoryInfo struct {
|
type DirectoryInfo struct {
|
||||||
Id string
|
Id string
|
||||||
Name string
|
Name string
|
||||||
Entries []Entry
|
Entries Entries
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c browser) Directory(id string) (*DirectoryInfo, error) {
|
func (c browser) Directory(id string) (*DirectoryInfo, error) {
|
||||||
@@ -87,7 +87,7 @@ func (c browser) Directory(id string) (*DirectoryInfo, error) {
|
|||||||
func (c browser) buildArtistDir(a *domain.Artist, albums *domain.Albums) *DirectoryInfo {
|
func (c browser) buildArtistDir(a *domain.Artist, albums *domain.Albums) *DirectoryInfo {
|
||||||
dir := &DirectoryInfo{Id: a.Id, Name: a.Name}
|
dir := &DirectoryInfo{Id: a.Id, Name: a.Name}
|
||||||
|
|
||||||
dir.Entries = make([]Entry, len(*albums))
|
dir.Entries = make(Entries, len(*albums))
|
||||||
for i, al := range *albums {
|
for i, al := range *albums {
|
||||||
dir.Entries[i] = FromAlbum(&al)
|
dir.Entries[i] = FromAlbum(&al)
|
||||||
}
|
}
|
||||||
@@ -97,7 +97,7 @@ func (c browser) buildArtistDir(a *domain.Artist, albums *domain.Albums) *Direct
|
|||||||
func (c browser) buildAlbumDir(al *domain.Album, tracks *domain.MediaFiles) *DirectoryInfo {
|
func (c browser) buildAlbumDir(al *domain.Album, tracks *domain.MediaFiles) *DirectoryInfo {
|
||||||
dir := &DirectoryInfo{Id: al.Id, Name: al.Name}
|
dir := &DirectoryInfo{Id: al.Id, Name: al.Name}
|
||||||
|
|
||||||
dir.Entries = make([]Entry, len(*tracks))
|
dir.Entries = make(Entries, len(*tracks))
|
||||||
for i, mf := range *tracks {
|
for i, mf := range *tracks {
|
||||||
dir.Entries[i] = FromMediaFile(&mf)
|
dir.Entries[i] = FromMediaFile(&mf)
|
||||||
}
|
}
|
||||||
|
|||||||
+2
-2
@@ -25,7 +25,7 @@ func (p playlists) GetAll() (*domain.Playlists, error) {
|
|||||||
type PlaylistInfo struct {
|
type PlaylistInfo struct {
|
||||||
Id string
|
Id string
|
||||||
Name string
|
Name string
|
||||||
Entries []Entry
|
Entries Entries
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p playlists) Get(id string) (*PlaylistInfo, error) {
|
func (p playlists) Get(id string) (*PlaylistInfo, error) {
|
||||||
@@ -39,7 +39,7 @@ func (p playlists) Get(id string) (*PlaylistInfo, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pinfo := &PlaylistInfo{Id: pl.Id, Name: pl.Name}
|
pinfo := &PlaylistInfo{Id: pl.Id, Name: pl.Name}
|
||||||
pinfo.Entries = make([]Entry, len(pl.Tracks))
|
pinfo.Entries = make(Entries, len(pl.Tracks))
|
||||||
|
|
||||||
// TODO Optimize: Get all tracks at once
|
// TODO Optimize: Get all tracks at once
|
||||||
for i, mfId := range pl.Tracks {
|
for i, mfId := range pl.Tracks {
|
||||||
|
|||||||
+1
-1
@@ -7,7 +7,7 @@ import (
|
|||||||
"github.com/deluan/gosonic/domain"
|
"github.com/deluan/gosonic/domain"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Results []Entry
|
type Results Entries
|
||||||
|
|
||||||
type Search interface {
|
type Search interface {
|
||||||
ClearAll() error
|
ClearAll() error
|
||||||
|
|||||||
Reference in New Issue
Block a user