diff --git a/jobs/sync-anime/main.go b/jobs/sync-anime/main.go index abc45851..7c87ddee 100644 --- a/jobs/sync-anime/main.go +++ b/jobs/sync-anime/main.go @@ -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{ - Service: "Youtube", - VideoID: attr.YoutubeVideoID, + anime.Trailers = append(anime.Trailers, arn.ExternalMedia{ + Service: "Youtube", + ServiceID: attr.YoutubeVideoID, }) } diff --git a/pages/anime/anime.pixy b/pages/anime/anime.pixy index 4ef007d7..0be1b18b 100644 --- a/pages/anime/anime.pixy +++ b/pages/anime/anime.pixy @@ -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 diff --git a/pages/music/music.go b/pages/music/music.go index b2d0d24a..64bdbb4f 100644 --- a/pages/music/music.go +++ b/pages/music/music.go @@ -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)) } diff --git a/pages/music/music.pixy b/pages/music/music.pixy index 046d14fa..0276ddd6 100644 --- a/pages/music/music.pixy +++ b/pages/music/music.pixy @@ -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") - //- \ No newline at end of file + .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") diff --git a/pages/music/music.scarlet b/pages/music/music.scarlet new file mode 100644 index 00000000..e3b59811 --- /dev/null +++ b/pages/music/music.scarlet @@ -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 \ No newline at end of file