Polishing

This commit is contained in:
Deluan 2016-03-24 14:44:21 -04:00
parent 770a16ece3
commit 3c8f6e9a65
4 changed files with 16 additions and 17 deletions

View file

@ -20,7 +20,7 @@ func (c *BrowsingController) Prepare() {
utils.ResolveDependencies(&c.browser) utils.ResolveDependencies(&c.browser)
} }
func (c *BrowsingController) GetMediaFolders() { func (c *BrowsingController) GetMusicFolders() {
mediaFolderList, _ := c.browser.MediaFolders() mediaFolderList, _ := c.browser.MediaFolders()
folders := make([]responses.MusicFolder, len(mediaFolderList)) folders := make([]responses.MusicFolder, len(mediaFolderList))
for i, f := range mediaFolderList { for i, f := range mediaFolderList {
@ -32,7 +32,6 @@ func (c *BrowsingController) GetMediaFolders() {
c.SendResponse(response) c.SendResponse(response)
} }
// TODO: Shortcuts amd validate musicFolder parameter
func (c *BrowsingController) GetIndexes() { func (c *BrowsingController) GetIndexes() {
ifModifiedSince := c.ParamTime("ifModifiedSince", time.Time{}) ifModifiedSince := c.ParamTime("ifModifiedSince", time.Time{})
@ -62,7 +61,7 @@ func (c *BrowsingController) GetIndexes() {
c.SendResponse(response) c.SendResponse(response)
} }
func (c *BrowsingController) GetDirectory() { func (c *BrowsingController) GetMusicDirectory() {
id := c.RequiredParamString("id", "id parameter required") id := c.RequiredParamString("id", "id parameter required")
response := c.NewEmpty() response := c.NewEmpty()

View file

@ -31,7 +31,7 @@ func (c *MediaRetrievalController) GetAvatar() {
io.Copy(c.Ctx.ResponseWriter, f) io.Copy(c.Ctx.ResponseWriter, f)
} }
func (c *MediaRetrievalController) GetCover() { func (c *MediaRetrievalController) GetCoverArt() {
id := c.RequiredParamString("id", "id parameter required") id := c.RequiredParamString("id", "id parameter required")
size := c.ParamInt("size", 0) size := c.ParamInt("size", 0)

View file

@ -19,7 +19,7 @@ func (c *PlaylistsController) Prepare() {
utils.ResolveDependencies(&c.pls) utils.ResolveDependencies(&c.pls)
} }
func (c *PlaylistsController) GetAll() { func (c *PlaylistsController) GetPlaylists() {
allPls, err := c.pls.GetAll() allPls, err := c.pls.GetAll()
if err != nil { if err != nil {
beego.Error(err) beego.Error(err)
@ -40,7 +40,7 @@ func (c *PlaylistsController) GetAll() {
c.SendResponse(response) c.SendResponse(response)
} }
func (c *PlaylistsController) Get() { func (c *PlaylistsController) GetPlaylist() {
id := c.RequiredParamString("id", "id parameter required") id := c.RequiredParamString("id", "id parameter required")
pinfo, err := c.pls.Get(id) pinfo, err := c.pls.Get(id)
@ -58,7 +58,7 @@ func (c *PlaylistsController) Get() {
c.SendResponse(response) c.SendResponse(response)
} }
func (c *PlaylistsController) Create() { func (c *PlaylistsController) CreatePlaylist() {
songIds := c.RequiredParamStrings("songId", "Required parameter songId is missing") songIds := c.RequiredParamStrings("songId", "Required parameter songId is missing")
name := c.RequiredParamString("name", "Required parameter name is missing") name := c.RequiredParamString("name", "Required parameter name is missing")
err := c.pls.Create(name, songIds) err := c.pls.Create(name, songIds)
@ -69,7 +69,7 @@ func (c *PlaylistsController) Create() {
c.SendEmptyResponse() c.SendEmptyResponse()
} }
func (c *PlaylistsController) Delete() { func (c *PlaylistsController) DeletePlaylist() {
id := c.RequiredParamString("id", "Required parameter id is missing") id := c.RequiredParamString("id", "Required parameter id is missing")
err := c.pls.Delete(id) err := c.pls.Delete(id)
if err != nil { if err != nil {
@ -79,7 +79,7 @@ func (c *PlaylistsController) Delete() {
c.SendEmptyResponse() c.SendEmptyResponse()
} }
func (c *PlaylistsController) Update() { func (c *PlaylistsController) UpdatePlaylist() {
playlistId := c.RequiredParamString("playlistId", "Required parameter playlistId is missing") playlistId := c.RequiredParamString("playlistId", "Required parameter playlistId is missing")
songsToAdd := c.ParamStrings("songIdToAdd") songsToAdd := c.ParamStrings("songIdToAdd")
songIndexesToRemove := c.ParamInts("songIndexToRemove") songIndexesToRemove := c.ParamInts("songIndexToRemove")

View file

@ -19,13 +19,13 @@ func mapEndpoints() {
beego.NSRouter("/ping.view", &api.SystemController{}, "*:Ping"), beego.NSRouter("/ping.view", &api.SystemController{}, "*:Ping"),
beego.NSRouter("/getLicense.view", &api.SystemController{}, "*:GetLicense"), beego.NSRouter("/getLicense.view", &api.SystemController{}, "*:GetLicense"),
beego.NSRouter("/getMusicFolders.view", &api.BrowsingController{}, "*:GetMediaFolders"), beego.NSRouter("/getMusicFolders.view", &api.BrowsingController{}, "*:GetMusicFolders"),
beego.NSRouter("/getIndexes.view", &api.BrowsingController{}, "*:GetIndexes"), beego.NSRouter("/getIndexes.view", &api.BrowsingController{}, "*:GetIndexes"),
beego.NSRouter("/getMusicDirectory.view", &api.BrowsingController{}, "*:GetDirectory"), beego.NSRouter("/getMusicDirectory.view", &api.BrowsingController{}, "*:GetMusicDirectory"),
beego.NSRouter("/search2.view", &api.SearchingController{}, "*:Search2"), beego.NSRouter("/search2.view", &api.SearchingController{}, "*:Search2"),
beego.NSRouter("/getCoverArt.view", &api.MediaRetrievalController{}, "*:GetCover"), beego.NSRouter("/getCoverArt.view", &api.MediaRetrievalController{}, "*:GetCoverArt"),
beego.NSRouter("/getAvatar.view", &api.MediaRetrievalController{}, "*:GetAvatar"), beego.NSRouter("/getAvatar.view", &api.MediaRetrievalController{}, "*:GetAvatar"),
beego.NSRouter("/stream.view", &api.StreamController{}, "*:Stream"), beego.NSRouter("/stream.view", &api.StreamController{}, "*:Stream"),
beego.NSRouter("/download.view", &api.StreamController{}, "*:Download"), beego.NSRouter("/download.view", &api.StreamController{}, "*:Download"),
@ -39,11 +39,11 @@ func mapEndpoints() {
beego.NSRouter("/getStarred.view", &api.AlbumListController{}, "*:GetStarred"), beego.NSRouter("/getStarred.view", &api.AlbumListController{}, "*:GetStarred"),
beego.NSRouter("/getNowPlaying.view", &api.AlbumListController{}, "*:GetNowPlaying"), beego.NSRouter("/getNowPlaying.view", &api.AlbumListController{}, "*:GetNowPlaying"),
beego.NSRouter("/getPlaylists.view", &api.PlaylistsController{}, "*:GetAll"), beego.NSRouter("/getPlaylists.view", &api.PlaylistsController{}, "*:GetPlaylists"),
beego.NSRouter("/getPlaylist.view", &api.PlaylistsController{}, "*:Get"), beego.NSRouter("/getPlaylist.view", &api.PlaylistsController{}, "*:GetPlaylist"),
beego.NSRouter("/createPlaylist.view", &api.PlaylistsController{}, "*:Create"), beego.NSRouter("/createPlaylist.view", &api.PlaylistsController{}, "*:CreatePlaylist"),
beego.NSRouter("/updatePlaylist.view", &api.PlaylistsController{}, "*:Update"), beego.NSRouter("/updatePlaylist.view", &api.PlaylistsController{}, "*:UpdatePlaylist"),
beego.NSRouter("/deletePlaylist.view", &api.PlaylistsController{}, "*:Delete"), beego.NSRouter("/deletePlaylist.view", &api.PlaylistsController{}, "*:DeletePlaylist"),
beego.NSRouter("/getUser.view", &api.UsersController{}, "*:GetUser"), beego.NSRouter("/getUser.view", &api.UsersController{}, "*:GetUser"),
) )