mirror of
https://github.com/navidrome/navidrome.git
synced 2024-09-10 11:32:48 +02:00
23 lines
627 B
Go
23 lines
627 B
Go
package api
|
|
|
|
import (
|
|
"github.com/astaxie/beego"
|
|
"github.com/deluan/gosonic/api/responses"
|
|
"github.com/deluan/gosonic/repositories"
|
|
)
|
|
|
|
type GetMusicFoldersController struct{ beego.Controller }
|
|
|
|
func (c *GetMusicFoldersController) Get() {
|
|
repository := repositories.NewMediaFolderRepository()
|
|
mediaFolderList, _ := repository.GetAll()
|
|
folders := make([]responses.MusicFolder, len(mediaFolderList))
|
|
for i, f := range mediaFolderList {
|
|
folders[i].Id = f.Id
|
|
folders[i].Name = f.Name
|
|
}
|
|
musicFolders := &responses.MusicFolders{Folders: folders}
|
|
response := responses.NewXML(musicFolders)
|
|
c.Ctx.Output.Body(response)
|
|
}
|