Improved music page

This commit is contained in:
Eduard Urbach 2017-06-27 13:46:29 +02:00
parent 57fda44d66
commit cc2e0c63ea
5 changed files with 60 additions and 10 deletions

View File

@ -59,12 +59,12 @@ func sync(data *kitsu.Anime) {
anime.Rating.Overall = overall
// Trailers
anime.Trailers = []arn.AnimeTrailer{}
anime.Trailers = []arn.ExternalMedia{}
if attr.YoutubeVideoID != "" {
anime.Trailers = append(anime.Trailers, arn.AnimeTrailer{
anime.Trailers = append(anime.Trailers, arn.ExternalMedia{
Service: "Youtube",
VideoID: attr.YoutubeVideoID,
ServiceID: attr.YoutubeVideoID,
})
}

View File

@ -45,10 +45,10 @@ component Anime(anime *arn.Anime, user *arn.User)
.anime-rating-category-name Soundtrack
Rating(anime.Rating.Soundtrack)
if len(anime.Trailers) > 0 && anime.Trailers[0].Service == "Youtube" && anime.Trailers[0].VideoID != ""
if len(anime.Trailers) > 0 && anime.Trailers[0].Service == "Youtube" && anime.Trailers[0].ServiceID != ""
h3.anime-section-name Video
.anime-trailer.video-container
iframe.video(src="https://www.youtube.com/embed/" + anime.Trailers[0].VideoID + "?showinfo=0", allowfullscreen="allowfullscreen")
iframe.video(src="https://www.youtube.com/embed/" + anime.Trailers[0].ServiceID + "?showinfo=0", allowfullscreen="allowfullscreen")
//- if anime.Tracks != nil && anime.Tracks.Opening != nil
//- h3.anime-section-name Tracks

View File

@ -2,8 +2,37 @@ package music
import "github.com/aerogo/aero"
import "github.com/animenotifier/notify.moe/components"
import "github.com/animenotifier/arn"
// Get renders the music page.
func Get(ctx *aero.Context) string {
return ctx.HTML(components.Music())
tracks := []*arn.SoundTrack{}
tracks = append(tracks, &arn.SoundTrack{
ID: "1",
Media: []arn.ExternalMedia{
arn.ExternalMedia{
Service: "Soundcloud",
ServiceID: "127672476",
},
},
Tags: []string{
"anime:7622",
},
})
tracks = append(tracks, &arn.SoundTrack{
ID: "2",
Media: []arn.ExternalMedia{
arn.ExternalMedia{
Service: "Soundcloud",
ServiceID: "270777538",
},
},
Tags: []string{
"anime:11469",
},
})
return ctx.HTML(components.Music(tracks))
}

View File

@ -1,5 +1,11 @@
component Music
component Music(tracks []*arn.SoundTrack)
h2.page-title Music
iframe(src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/127672476&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true")
//- <iframe width="100%" height="450" scrolling="no" frameborder="no" src="https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/127672476&amp;auto_play=false&amp;hide_related=false&amp;show_comments=true&amp;show_user=true&amp;show_reposts=false&amp;visual=true"></iframe>
.sound-tracks
each track in tracks
.sound-track
each anime in track.Anime()
a.sound-track-anime-link.ajax(href="/anime/" + anime.ID)
img.sound-track-anime-image(src=anime.Image.Small, alt=anime.Title.Canonical, title=anime.Title.Canonical)
iframe(src="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/" + track.Media[0].ServiceID + "?auto_play=false&hide_related=true&show_comments=true&show_user=true&show_reposts=false&visual=true")

15
pages/music/music.scarlet Normal file
View File

@ -0,0 +1,15 @@
.sound-tracks
vertical
.sound-track
horizontal
margin-bottom 1rem
iframe
width 100%
.sound-track-anime-link
//
.sound-track-anime-image
max-width 142px