🎧 Your Personal Streaming Service
Go airsonicmadsonicmedia-servermusicmusic-servernavidromeopensubsonicraspberry-piself-hostedstreamerstreaming-apistreaming-audiosubsonicsubsonic-server
More metadata for children (albums/mediafiles)
Deluan5fd9da505e5a
diff --git a/api/base_api_controller.go b/api/base_api_controller.goindex 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.Typereturn n}diff --git a/api/responses/responses.go b/api/responses/responses.goindex 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"`/*- <xs:attribute name="path" type="xs:string" use="optional"/>- <xs:attribute name="isVideo" type="xs:boolean" use="optional"/> <!-- Added in 1.4.1 -->- <xs:attribute name="userRating" type="sub:UserRating" use="optional"/> <!-- Added in 1.6.0 -->- <xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.6.0 -->- <xs:attribute name="playCount" type="xs:long" use="optional"/> <!-- Added in 1.14.0 -->- <xs:attribute name="discNumber" type="xs:int" use="optional"/> <!-- Added in 1.8.0 -->- <xs:attribute name="created" type="xs:dateTime" use="optional"/> <!-- Added in 1.8.0 -->- <xs:attribute name="starred" type="xs:dateTime" use="optional"/> <!-- Added in 1.8.0 -->- <xs:attribute name="albumId" type="xs:string" use="optional"/> <!-- Added in 1.8.0 -->- <xs:attribute name="artistId" type="xs:string" use="optional"/> <!-- Added in 1.8.0 -->- <xs:attribute name="type" type="sub:MediaType" use="optional"/> <!-- Added in 1.8.0 -->- <xs:attribute name="bookmarkPosition" type="xs:long" use="optional"/> <!-- In millis. Added in 1.10.1 -->- <xs:attribute name="originalWidth" type="xs:int" use="optional"/> <!-- Added in 1.13.0 -->- <xs:attribute name="originalHeight" type="xs:int" use="optional"/> <!-- Added in 1.13.0 -->+ <xs:attribute name="isVideo" type="xs:boolean" use="optional"/> <!-- Added in 1.4.1 -->+ <xs:attribute name="userRating" type="sub:UserRating" use="optional"/> <!-- Added in 1.6.0 -->+ <xs:attribute name="averageRating" type="sub:AverageRating" use="optional"/> <!-- Added in 1.6.0 -->+ <xs:attribute name="bookmarkPosition" type="xs:long" use="optional"/> <!-- In millis. Added in 1.10.1 -->+ <xs:attribute name="originalWidth" type="xs:int" use="optional"/> <!-- Added in 1.13.0 -->+ <xs:attribute name="originalHeight" type="xs:int" use="optional"/> <!-- Added in 1.13.0 -->*/}diff --git a/domain/mediafile.go b/domain/mediafile.goindex b26e4f326..ebe19f17f 100644--- a/domain/mediafile.go+++ b/domain/mediafile.go@@ -11,6 +11,7 @@ type MediaFile struct {Title stringAlbum stringArtist string+ ArtistId stringAlbumArtist stringAlbumId string `parent:"album"`HasCoverArt booldiff --git a/engine/common.go b/engine/common.goindex 49ba37f9e..b6cda4fc5 100644--- a/engine/common.go+++ b/engine/common.go@@ -24,6 +24,13 @@ type Entry struct {Suffix stringBitRate intContentType string+ Path string+ PlayCount int32+ DiscNumber int+ Created time.Time+ AlbumId string+ ArtistId string+ Type stringUserName stringMinutesAgo 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.ArtistIdreturn 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 nowreturn c}diff --git a/scanner/itunes_scanner.go b/scanner/itunes_scanner.goindex 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)