Added Youtube support for sound tracks

This commit is contained in:
Eduard Urbach 2017-06-27 23:33:21 +02:00
parent c1765a23ea
commit 5099c0b0e7
5 changed files with 30 additions and 19 deletions

10
mixins/SoundTrack.pixy Normal file
View File

@ -0,0 +1,10 @@
component SoundTrack(track *arn.SoundTrack)
.sound-track.mountable(id=track.ID)
.sound-track-content
a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID)
img.sound-track-anime-image.lazy(data-src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical)
iframe.lazy(data-src=track.Media[0].EmbedLink())
.sound-track-footer
span posted by
a.ajax(href=track.CreatedByUser().Link())= track.CreatedByUser().Nick

View File

@ -9,15 +9,3 @@ component Music(tracks []*arn.SoundTrack)
.sound-tracks .sound-tracks
each track in tracks each track in tracks
SoundTrack(track) SoundTrack(track)
component SoundTrack(track *arn.SoundTrack)
.sound-track.mountable(id=track.ID)
.sound-track-content
a.sound-track-anime-link.ajax(href="/anime/" + track.MainAnime().ID)
img.sound-track-anime-image.lazy(data-src=track.MainAnime().Image.Small, alt=track.MainAnime().Title.Canonical, title=track.MainAnime().Title.Canonical)
iframe.lazy(data-src="https://w.soundcloud.com/player/?url=https://api.soundcloud.com/tracks/" + track.Media[0].ServiceID + "?auto_play=false&hide_related=true&show_comments=false&show_user=false&show_reposts=false&visual=true")
.sound-track-footer
span posted by
a.ajax(href=track.CreatedByUser().Link())= track.CreatedByUser().Nick

View File

@ -1,10 +1,20 @@
component NewSoundTrack(user *arn.User) component NewSoundTrack(user *arn.User)
.widgets .widgets
.widget .widget
input#soundcloud-link.widget-element(type="text", placeholder="Soundcloud link") h3 New soundtrack
input#anime-link.widget-element(type="text", placeholder="Anime link") label(for="soundcloud-link") Soundcloud link:
input#osu-link.widget-element(type="text", placeholder="Osu beatmap link (optional)") input#soundcloud-link.widget-element(type="text", placeholder="https://soundcloud.com/abc/123")
label(for="youtube-link") Youtube link:
input#youtube-link.widget-element(type="text", placeholder="https://www.youtube.com/watch?v=123")
label(for="anime-link") Anime link:
input#anime-link.widget-element(type="text", placeholder="https://notify.moe/anime/123")
label(for="osu-link") Osu beatmap (optional):
input#osu-link.widget-element(type="text", placeholder="https://osu.ppy.sh/s/123")
.buttons
button.action(data-action="createSoundTrack", data-trigger="click") button.action(data-action="createSoundTrack", data-trigger="click")
Icon("check") Icon("check")
span Add soundtrack span Add soundtrack

View File

@ -106,11 +106,13 @@ export function createThread(arn: AnimeNotifier) {
// Create soundtrack // Create soundtrack
export function createSoundTrack(arn: AnimeNotifier, button: HTMLButtonElement) { export function createSoundTrack(arn: AnimeNotifier, button: HTMLButtonElement) {
let soundcloud = arn.app.find("soundcloud-link") as HTMLInputElement let soundcloud = arn.app.find("soundcloud-link") as HTMLInputElement
let youtube = arn.app.find("youtube-link") as HTMLInputElement
let anime = arn.app.find("anime-link") as HTMLInputElement let anime = arn.app.find("anime-link") as HTMLInputElement
let osu = arn.app.find("osu-link") as HTMLInputElement let osu = arn.app.find("osu-link") as HTMLInputElement
let soundtrack = { let soundtrack = {
soundcloud: soundcloud.value, soundcloud: soundcloud.value,
youtube: youtube.value,
tags: [anime.value, osu.value], tags: [anime.value, osu.value],
} }

View File

@ -121,6 +121,7 @@ var tests = map[string][]string{
"/auth/google": nil, "/auth/google": nil,
"/auth/google/callback": nil, "/auth/google/callback": nil,
"/new/thread": nil, "/new/thread": nil,
"/new/soundtrack": nil,
"/user": nil, "/user": nil,
"/settings": nil, "/settings": nil,
"/extension/embed": nil, "/extension/embed": nil,