27 lines
625 B
Go
Raw Normal View History

2017-10-02 04:29:58 +00:00
package soundtrack
2017-06-27 22:16:45 +00:00
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
2019-06-01 04:55:49 +00:00
"github.com/animenotifier/notify.moe/middleware"
2017-11-05 18:54:58 +00:00
"github.com/animenotifier/notify.moe/utils"
2017-06-27 22:16:45 +00:00
)
2017-07-13 06:23:20 +00:00
// Get track.
2019-06-01 04:55:49 +00:00
func Get(ctx aero.Context) error {
2017-06-27 22:16:45 +00:00
id := ctx.Get("id")
track, err := arn.GetSoundTrack(id)
2017-11-05 18:54:58 +00:00
user := utils.GetUser(ctx)
2017-06-27 22:16:45 +00:00
if err != nil {
return ctx.Error(http.StatusNotFound, "Track not found", err)
}
2019-06-01 04:55:49 +00:00
customCtx := ctx.(*middleware.OpenGraphContext)
customCtx.OpenGraph = getOpenGraph(ctx, track)
2018-10-29 02:56:45 +00:00
return ctx.HTML(components.SoundTrackPage(track, user))
2018-04-13 10:20:13 +00:00
}