mirror of
https://github.com/navidrome/navidrome.git
synced 2025-06-14 14:22:28 +03:00
More metadata for children (albums/mediafiles)
This commit is contained in:
parent
37f72f2efc
commit
5fd9da505e
@ -104,5 +104,14 @@ func (c *BaseAPIController) ToChild(entry engine.Entry) responses.Child {
|
|||||||
if !entry.Starred.IsZero() {
|
if !entry.Starred.IsZero() {
|
||||||
n.Starred = &entry.Starred
|
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
|
return n
|
||||||
}
|
}
|
||||||
|
@ -85,18 +85,17 @@ type Child struct {
|
|||||||
TranscodedSuffix string `xml:"transcodedSuffix,attr,omitempty" json:"transcodedSuffix,omitempty"`
|
TranscodedSuffix string `xml:"transcodedSuffix,attr,omitempty" json:"transcodedSuffix,omitempty"`
|
||||||
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
|
Duration int `xml:"duration,attr,omitempty" json:"duration,omitempty"`
|
||||||
BitRate int `xml:"bitRate,attr,omitempty" json:"bitRate,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="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="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="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="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="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="originalHeight" type="xs:int" use="optional"/> <!-- Added in 1.13.0 -->
|
||||||
|
@ -11,6 +11,7 @@ type MediaFile struct {
|
|||||||
Title string
|
Title string
|
||||||
Album string
|
Album string
|
||||||
Artist string
|
Artist string
|
||||||
|
ArtistId string
|
||||||
AlbumArtist string
|
AlbumArtist string
|
||||||
AlbumId string `parent:"album"`
|
AlbumId string `parent:"album"`
|
||||||
HasCoverArt bool
|
HasCoverArt bool
|
||||||
|
@ -24,6 +24,13 @@ type Entry struct {
|
|||||||
Suffix string
|
Suffix string
|
||||||
BitRate int
|
BitRate int
|
||||||
ContentType string
|
ContentType string
|
||||||
|
Path string
|
||||||
|
PlayCount int32
|
||||||
|
DiscNumber int
|
||||||
|
Created time.Time
|
||||||
|
AlbumId string
|
||||||
|
ArtistId string
|
||||||
|
Type string
|
||||||
|
|
||||||
UserName string
|
UserName string
|
||||||
MinutesAgo int
|
MinutesAgo int
|
||||||
@ -51,6 +58,10 @@ func FromAlbum(al *domain.Album) Entry {
|
|||||||
if al.Starred {
|
if al.Starred {
|
||||||
c.Starred = al.UpdatedAt
|
c.Starred = al.UpdatedAt
|
||||||
}
|
}
|
||||||
|
c.PlayCount = int32(al.PlayCount)
|
||||||
|
c.Created = al.CreatedAt
|
||||||
|
c.AlbumId = al.Id
|
||||||
|
c.ArtistId = al.ArtistId
|
||||||
return c
|
return c
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,5 +87,12 @@ func FromMediaFile(mf *domain.MediaFile) Entry {
|
|||||||
c.CoverArt = mf.Id
|
c.CoverArt = mf.Id
|
||||||
}
|
}
|
||||||
c.ContentType = mf.ContentType()
|
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
|
return c
|
||||||
}
|
}
|
||||||
|
@ -206,6 +206,7 @@ func (s *ItunesScanner) collectMediaFiles(t *itl.Track) *domain.MediaFile {
|
|||||||
mf.Id = strconv.Itoa(t.TrackID)
|
mf.Id = strconv.Itoa(t.TrackID)
|
||||||
mf.Album = unescape(t.Album)
|
mf.Album = unescape(t.Album)
|
||||||
mf.AlbumId = albumId(t)
|
mf.AlbumId = albumId(t)
|
||||||
|
mf.ArtistId = artistId(t)
|
||||||
mf.Title = unescape(t.Name)
|
mf.Title = unescape(t.Name)
|
||||||
mf.Artist = unescape(t.Artist)
|
mf.Artist = unescape(t.Artist)
|
||||||
mf.AlbumArtist = unescape(t.AlbumArtist)
|
mf.AlbumArtist = unescape(t.AlbumArtist)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user