@@ -77,6 +77,7 @@ func (c *Controller) ServeGetAlbum(r *http.Request) *spec.Response {
|
|||||||
album := &db.Album{}
|
album := &db.Album{}
|
||||||
err = c.DB.
|
err = c.DB.
|
||||||
Preload("TagArtist").
|
Preload("TagArtist").
|
||||||
|
Preload("TagGenre").
|
||||||
Preload("Tracks", func(db *gorm.DB) *gorm.DB {
|
Preload("Tracks", func(db *gorm.DB) *gorm.DB {
|
||||||
return db.Order("tracks.tag_disc_number, tracks.tag_track_number")
|
return db.Order("tracks.tag_disc_number, tracks.tag_track_number")
|
||||||
}).
|
}).
|
||||||
|
|||||||
@@ -11,8 +11,12 @@ func NewAlbumByTags(a *db.Album, artist *db.Artist) *Album {
|
|||||||
Created: a.ModifiedAt,
|
Created: a.ModifiedAt,
|
||||||
ID: a.ID,
|
ID: a.ID,
|
||||||
Name: a.TagTitle,
|
Name: a.TagTitle,
|
||||||
|
Year: a.TagYear,
|
||||||
TrackCount: a.ChildCount,
|
TrackCount: a.ChildCount,
|
||||||
}
|
}
|
||||||
|
if a.TagGenre != nil {
|
||||||
|
ret.Genre = a.TagGenre.Name
|
||||||
|
}
|
||||||
if a.Cover != "" {
|
if a.Cover != "" {
|
||||||
ret.CoverID = a.ID
|
ret.CoverID = a.ID
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,16 +92,18 @@ type Album struct {
|
|||||||
CoverID int `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty,string"`
|
CoverID int `xml:"coverArt,attr,omitempty" json:"coverArt,omitempty,string"`
|
||||||
ArtistID int `xml:"artistId,attr,omitempty" json:"artistId,omitempty,string"`
|
ArtistID int `xml:"artistId,attr,omitempty" json:"artistId,omitempty,string"`
|
||||||
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
|
Artist string `xml:"artist,attr,omitempty" json:"artist,omitempty"`
|
||||||
// browsing by folder (getAlbumList)
|
// browsing by folder (eg. getAlbumList)
|
||||||
Title string `xml:"title,attr,omitempty" json:"title,omitempty"`
|
Title string `xml:"title,attr,omitempty" json:"title,omitempty"`
|
||||||
Album string `xml:"album,attr,omitempty" json:"album,omitempty"`
|
Album string `xml:"album,attr,omitempty" json:"album,omitempty"`
|
||||||
ParentID int `xml:"parent,attr,omitempty" json:"parent,omitempty,string"`
|
ParentID int `xml:"parent,attr,omitempty" json:"parent,omitempty,string"`
|
||||||
IsDir bool `xml:"isDir,attr,omitempty" json:"isDir,omitempty"`
|
IsDir bool `xml:"isDir,attr,omitempty" json:"isDir,omitempty"`
|
||||||
// browsing by tags (getAlbumList2)
|
// browsing by tags (eg. getAlbumList2)
|
||||||
Name string `xml:"name,attr,omitempty" json:"name,omitempty"`
|
Name string `xml:"name,attr,omitempty" json:"name,omitempty"`
|
||||||
TrackCount int `xml:"songCount,attr" json:"songCount"`
|
TrackCount int `xml:"songCount,attr" json:"songCount"`
|
||||||
Duration int `xml:"duration,attr" json:"duration"`
|
Duration int `xml:"duration,attr" json:"duration"`
|
||||||
Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
|
Created time.Time `xml:"created,attr,omitempty" json:"created,omitempty"`
|
||||||
|
Genre string `xml:"genre,attr,omitempty" json:"genre,omitempty"`
|
||||||
|
Year int `xml:"year,attr,omitempty" json:"year,omitempty"`
|
||||||
Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"`
|
Tracks []*TrackChild `xml:"song,omitempty" json:"song,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user