diff --git a/api/base_api_controller.go b/api/base_api_controller.go index 09b2a3cbf..983623b99 100644 --- a/api/base_api_controller.go +++ b/api/base_api_controller.go @@ -104,5 +104,14 @@ func (c *BaseAPIController) ToChild(entry engine.Entry) responses.Child { if !entry.Starred.IsZero() { n.Starred = &entry.Starred } + n.Path = entry.Path + n.PlayCount = entry.PlayCount + n.DiscNumber = entry.DiscNumber + if !entry.Created.IsZero() { + n.Created = &entry.Created + } + n.AlbumId = entry.AlbumId + n.ArtistId = entry.ArtistId + n.Type = entry.Type return n } diff --git a/api/responses/responses.go b/api/responses/responses.go index 89237b388..0c0a87dff 100644 --- a/api/responses/responses.go +++ b/api/responses/responses.go @@ -85,21 +85,20 @@ type Child struct { TranscodedSuffix string `xml:"transcodedSuffix,attr,omitempty" json:"transcodedSuffix,omitempty"` Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"` BitRate int `xml:"bitRate,attr,omitempty" json:"bitRate,omitempty"` + Path string `xml:"path,attr,omitempty" json:"path,omitempty"` + PlayCount int32 `xml:"playCount,attr,omitempty" json:"playcount,omitempty"` + DiscNumber int `xml:"discNumber,attr,omitempty" json:"discNumber,omitempty"` + Created *time.Time `xml:"created,attr,omitempty" json:"created,omitempty"` + AlbumId string `xml:"albumId,attr,omitempty" json:"albumId,omitempty"` + ArtistId string `xml:"artistId,attr,omitempty" json:"artistId,omitempty"` + Type string `xml:"type,attr,omitempty" json:"type,omitempty"` /* - - - - - - - - - - - - - - + + + + + + */ } diff --git a/domain/mediafile.go b/domain/mediafile.go index b26e4f326..ebe19f17f 100644 --- a/domain/mediafile.go +++ b/domain/mediafile.go @@ -11,6 +11,7 @@ type MediaFile struct { Title string Album string Artist string + ArtistId string AlbumArtist string AlbumId string `parent:"album"` HasCoverArt bool diff --git a/engine/common.go b/engine/common.go index 49ba37f9e..b6cda4fc5 100644 --- a/engine/common.go +++ b/engine/common.go @@ -24,6 +24,13 @@ type Entry struct { Suffix string BitRate int ContentType string + Path string + PlayCount int32 + DiscNumber int + Created time.Time + AlbumId string + ArtistId string + Type string UserName string MinutesAgo int @@ -51,6 +58,10 @@ func FromAlbum(al *domain.Album) Entry { if al.Starred { c.Starred = al.UpdatedAt } + c.PlayCount = int32(al.PlayCount) + c.Created = al.CreatedAt + c.AlbumId = al.Id + c.ArtistId = al.ArtistId return c } @@ -76,5 +87,12 @@ func FromMediaFile(mf *domain.MediaFile) Entry { c.CoverArt = mf.Id } c.ContentType = mf.ContentType() + c.Path = mf.Path + c.PlayCount = int32(mf.PlayCount) + c.DiscNumber = mf.DiscNumber + c.Created = mf.CreatedAt + c.AlbumId = mf.AlbumId + c.ArtistId = mf.ArtistId + c.Type = "music" // TODO Hardcoded for now return c } diff --git a/scanner/itunes_scanner.go b/scanner/itunes_scanner.go index 074cb8215..7241e8b76 100644 --- a/scanner/itunes_scanner.go +++ b/scanner/itunes_scanner.go @@ -206,6 +206,7 @@ func (s *ItunesScanner) collectMediaFiles(t *itl.Track) *domain.MediaFile { mf.Id = strconv.Itoa(t.TrackID) mf.Album = unescape(t.Album) mf.AlbumId = albumId(t) + mf.ArtistId = artistId(t) mf.Title = unescape(t.Name) mf.Artist = unescape(t.Artist) mf.AlbumArtist = unescape(t.AlbumArtist)