Even more metadata for playlists

This commit is contained in:
Deluan
2016-03-21 12:26:55 -04:00
parent 3cefc321b8
commit a9d7d4d242
6 changed files with 37 additions and 14 deletions
+15 -4
View File
@@ -23,9 +23,13 @@ func (p playlists) GetAll() (domain.Playlists, error) {
}
type PlaylistInfo struct {
Id string
Name string
Entries Entries
Id string
Name string
Entries Entries
SongCount int
Duration int
Public bool
Owner string
}
func (p playlists) Get(id string) (*PlaylistInfo, error) {
@@ -37,7 +41,14 @@ func (p playlists) Get(id string) (*PlaylistInfo, error) {
return nil, err
}
pinfo := &PlaylistInfo{Id: pl.Id, Name: pl.Name}
pinfo := &PlaylistInfo{
Id: pl.Id,
Name: pl.Name,
SongCount: len(pl.Tracks),
Duration: pl.Duration,
Public: pl.Public,
Owner: pl.Owner,
}
pinfo.Entries = make(Entries, len(pl.Tracks))
// TODO Optimize: Get all tracks at once