getNowPlaying.view working
This commit is contained in:
+14
-1
@@ -90,8 +90,21 @@ func (c *AlbumListController) GetStarred() {
|
||||
}
|
||||
|
||||
func (c *AlbumListController) GetNowPlaying() {
|
||||
npInfos, err := c.listGen.GetNowPlaying()
|
||||
if err != nil {
|
||||
beego.Error("Error retrieving now playing list:", err)
|
||||
c.SendError(responses.ERROR_GENERIC, "Internal Error")
|
||||
}
|
||||
|
||||
response := c.NewEmpty()
|
||||
response.NowPlaying = &responses.NowPlaying{}
|
||||
//response.NowPlaying.Entry = make([]responses.NowPlayingEntry, 1)
|
||||
response.NowPlaying.Entry = make([]responses.NowPlayingEntry, len(*npInfos))
|
||||
for i, entry := range *npInfos {
|
||||
response.NowPlaying.Entry[i].Child = c.ToChild(entry)
|
||||
response.NowPlaying.Entry[i].UserName = entry.UserName
|
||||
response.NowPlaying.Entry[i].MinutesAgo = entry.MinutesAgo
|
||||
response.NowPlaying.Entry[i].PlayerId = entry.PlayerId
|
||||
response.NowPlaying.Entry[i].PlayerName = entry.PlayerName
|
||||
}
|
||||
c.SendResponse(response)
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@ func (c *MediaAnnotationController) Scrobble() {
|
||||
time := c.ParamTime("time", time.Now())
|
||||
submission := c.ParamBool("submission", false)
|
||||
|
||||
playerName := c.Data["c"].(string)
|
||||
username := c.Data["u"].(string)
|
||||
playerName := c.ParamString("c")
|
||||
username := c.ParamString("u")
|
||||
|
||||
if submission {
|
||||
mf, err := c.scrobbler.Register(id, time)
|
||||
|
||||
@@ -141,10 +141,10 @@ type Starred struct {
|
||||
|
||||
type NowPlayingEntry struct {
|
||||
Child
|
||||
UserName string `xml:"username" json:"username,omitempty"`
|
||||
MinutesAgo int `xml:"minutesAgo" json:"minutesAgo,omitempty"`
|
||||
PlayerId int `xml:"playerId" json:"playerId,omitempty"`
|
||||
PlayerName string `xml:"playerName" json:"playerName,omitempty"`
|
||||
UserName string `xml:"username,attr" json:"username,omitempty"`
|
||||
MinutesAgo int `xml:"minutesAgo,attr" json:"minutesAgo,omitempty"`
|
||||
PlayerId int `xml:"playerId,attr" json:"playerId,omitempty"`
|
||||
PlayerName string `xml:"playerName,attr" json:"playerName,omitempty"`
|
||||
}
|
||||
|
||||
type NowPlaying struct {
|
||||
|
||||
@@ -32,7 +32,6 @@ func checkParameters(c BaseAPIController) {
|
||||
logWarn(c, fmt.Sprintf(`Missing required parameter "%s"`, p))
|
||||
abortRequest(c, responses.ERROR_MISSING_PARAMETER)
|
||||
}
|
||||
c.Data[p] = c.GetString(p)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user