Cleanup
This commit is contained in:
28
pages/soundtracks/soundtracks.go
Normal file
28
pages/soundtracks/soundtracks.go
Normal file
@ -0,0 +1,28 @@
|
||||
package soundtracks
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
)
|
||||
|
||||
const maxTracks = 9
|
||||
|
||||
// Get renders the music page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
tracks, err := arn.AllSoundTracks()
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusInternalServerError, "Error fetching soundtracks", err)
|
||||
}
|
||||
|
||||
arn.SortSoundTracksLatestFirst(tracks)
|
||||
|
||||
if len(tracks) > maxTracks {
|
||||
tracks = tracks[:maxTracks]
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Music(tracks))
|
||||
}
|
Reference in New Issue
Block a user