getArtists.view implemented

This commit is contained in:
Deluan 2016-03-27 20:35:10 -04:00
parent 3cc92a32bd
commit 0a137657fe
3 changed files with 20 additions and 3 deletions

View file

@ -32,9 +32,7 @@ func (c *BrowsingController) GetMusicFolders() {
c.SendResponse(response)
}
func (c *BrowsingController) GetIndexes() {
ifModifiedSince := c.ParamTime("ifModifiedSince", time.Time{})
func (c *BrowsingController) getArtistIndex(ifModifiedSince time.Time) responses.Indexes {
indexes, lastModified, err := c.browser.Indexes(ifModifiedSince)
if err != nil {
beego.Error("Error retrieving Indexes:", err)
@ -56,12 +54,27 @@ func (c *BrowsingController) GetIndexes() {
res.Index[i].Artists[j].AlbumCount = a.AlbumCount
}
}
return res
}
func (c *BrowsingController) GetIndexes() {
ifModifiedSince := c.ParamTime("ifModifiedSince", time.Time{})
res := c.getArtistIndex(ifModifiedSince)
response := c.NewEmpty()
response.Indexes = &res
c.SendResponse(response)
}
func (c *BrowsingController) GetArtists() {
res := c.getArtistIndex(time.Time{})
response := c.NewEmpty()
response.Artist = &res
c.SendResponse(response)
}
func (c *BrowsingController) GetMusicDirectory() {
id := c.RequiredParamString("id", "id parameter required")

View file

@ -22,6 +22,9 @@ type Subsonic struct {
Starred *Starred `xml:"starred,omitempty" json:"starred,omitempty"`
NowPlaying *NowPlaying `xml:"nowPlaying,omitempty" json:"nowPlaying,omitempty"`
Song *Child `xml:"song,omitempty" json:"song,omitempty"`
// ID3
Artist *Indexes `xml:"artists,omitempty" json:"artists,omitempty"`
}
type JsonWrapper struct {

View file

@ -24,6 +24,7 @@ func mapEndpoints() {
beego.NSRouter("/getIndexes.view", &api.BrowsingController{}, "*:GetIndexes"),
beego.NSRouter("/getMusicDirectory.view", &api.BrowsingController{}, "*:GetMusicDirectory"),
beego.NSRouter("/getSong.view", &api.BrowsingController{}, "*:GetSong"),
beego.NSRouter("/getArtists.view", &api.BrowsingController{}, "*:GetArtists"),
beego.NSRouter("/search2.view", &api.SearchingController{}, "*:Search2"),