Episode page improvements
This commit is contained in:
parent
20a4e31999
commit
2b8288e208
@ -40,6 +40,7 @@ func main() {
|
||||
}
|
||||
|
||||
defer discord.Close()
|
||||
defer arn.Node.Close()
|
||||
|
||||
// Receive events
|
||||
discord.AddHandler(OnMessageCreate)
|
||||
|
@ -1,5 +1,3 @@
|
||||
const amv-large-width = 854px
|
||||
|
||||
.amvs
|
||||
vertical
|
||||
|
||||
|
@ -1,14 +1,34 @@
|
||||
package episode
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
minio "github.com/minio/minio-go"
|
||||
)
|
||||
|
||||
var spaces *minio.Client
|
||||
|
||||
func init() {
|
||||
go func() {
|
||||
var err error
|
||||
endpoint := "sfo2.digitaloceanspaces.com"
|
||||
ssl := true
|
||||
|
||||
// Initiate a client using DigitalOcean Spaces.
|
||||
spaces, err = minio.New(endpoint, arn.APIKeys.S3.ID, arn.APIKeys.S3.Secret, ssl)
|
||||
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
}
|
||||
}()
|
||||
}
|
||||
|
||||
// Get renders the anime episode.
|
||||
func Get(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
@ -33,11 +53,19 @@ func Get(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusNotFound, "Anime episodes not found", err)
|
||||
}
|
||||
|
||||
// Does the episode exist?
|
||||
uploaded := false
|
||||
|
||||
if spaces != nil {
|
||||
stat, err := spaces.StatObject("arn", fmt.Sprintf("videos/anime/%s/%d.webm", anime.ID, episodeNumber), minio.StatObjectOptions{})
|
||||
uploaded = (err == nil) && (stat.Size > 0)
|
||||
}
|
||||
|
||||
episode, episodeIndex := animeEpisodes.Find(episodeNumber)
|
||||
|
||||
if episode == nil {
|
||||
return ctx.Error(http.StatusNotFound, "Anime episode not found")
|
||||
}
|
||||
|
||||
return ctx.HTML(components.AnimeEpisode(anime, episode, episodeIndex, user))
|
||||
return ctx.HTML(components.AnimeEpisode(anime, episode, episodeIndex, uploaded, user))
|
||||
}
|
||||
|
@ -1,31 +1,31 @@
|
||||
component AnimeEpisode(anime *arn.Anime, episode *arn.AnimeEpisode, episodeIndex int, user *arn.User)
|
||||
component AnimeEpisode(anime *arn.Anime, episode *arn.AnimeEpisode, episodeIndex int, uploaded bool, user *arn.User)
|
||||
h1
|
||||
a(href=anime.Link())= anime.Title.ByUser(user)
|
||||
|
||||
if anime.ID == "GWyShKmiR" && episode.Number == 10
|
||||
.widget-form.amv-page
|
||||
.video-container(id="stream-test")
|
||||
video.video.lazy.action(data-action="toggleFullscreen", data-trigger="dblclick", data-id="stream-test")
|
||||
source(data-src="https://arn.sfo2.cdn.digitaloceanspaces.com/videos/anime/GWyShKmiR/10.webm", data-type="video/webm")
|
||||
track(label="English", kind="subtitles", srclang="en", src="/subtitles/anime/GWyShKmiR/10.en.vtt", default)
|
||||
|
||||
VideoControls("stream-test", time.Duration(0))
|
||||
.episode-navigation-container
|
||||
if episodeIndex > 0
|
||||
.episode-arrow.episode-arrow-previous
|
||||
a.light-button(href=anime.Link() + "/episode/" + strconv.Itoa(anime.Episodes().Items[episodeIndex - 1].Number), title="Previous episode")
|
||||
RawIcon("chevron-left")
|
||||
|
||||
br
|
||||
else
|
||||
.episode-view-image-container
|
||||
if episodeIndex > 0
|
||||
.episode-arrow.episode-arrow-previous
|
||||
a.light-button(href=anime.Link() + "/episode/" + strconv.Itoa(anime.Episodes().Items[episodeIndex - 1].Number), title="Previous episode")
|
||||
RawIcon("chevron-left")
|
||||
|
||||
a(href=anime.Link(), title=anime.Title.ByUser(user))
|
||||
img.anime-cover-image.lazy(data-src=anime.ImageLink("large"), data-webp="true", data-color=anime.AverageColor(), alt=anime.Title.ByUser(user))
|
||||
.episode-video
|
||||
if uploaded
|
||||
.video-container(id="stream-test")
|
||||
video.video.lazy.action(data-action="toggleFullscreen", data-trigger="dblclick", data-id="stream-test")
|
||||
source(data-src=fmt.Sprintf("https://arn.sfo2.cdn.digitaloceanspaces.com/videos/anime/%s/%d.webm", anime.ID, episode.Number), data-type="video/webm")
|
||||
track(label="English", kind="subtitles", srclang="en", src=fmt.Sprintf("/subtitles/anime/%s/%d.en.vtt", anime.ID, episode.Number), default)
|
||||
|
||||
if episodeIndex < len(anime.Episodes().Items) - 1
|
||||
.episode-arrow.episode-arrow-next
|
||||
a.light-button(href=anime.Link() + "/episode/" + strconv.Itoa(anime.Episodes().Items[episodeIndex + 1].Number), title="Next episode")
|
||||
RawIcon("chevron-right")
|
||||
VideoControls("stream-test", time.Duration(0))
|
||||
else
|
||||
.video-container.episode-not-available(title="Episode not available yet")
|
||||
|
||||
//- a(href=anime.Link(), title=anime.Title.ByUser(user))
|
||||
//- img.anime-cover-image.lazy(data-src=anime.ImageLink("large"), data-webp="true", data-color=anime.AverageColor(), alt=anime.Title.ByUser(user))
|
||||
|
||||
if episodeIndex < len(anime.Episodes().Items) - 1
|
||||
.episode-arrow.episode-arrow-next
|
||||
a.light-button(href=anime.Link() + "/episode/" + strconv.Itoa(anime.Episodes().Items[episodeIndex + 1].Number), title="Next episode")
|
||||
RawIcon("chevron-right")
|
||||
|
||||
h3.episode-view-number= "Episode " + strconv.Itoa(episode.Number)
|
||||
|
||||
|
@ -11,14 +11,20 @@
|
||||
font-size 0.9rem
|
||||
half-opacity-text
|
||||
|
||||
.episode-view-image-container
|
||||
.episode-navigation-container
|
||||
horizontal
|
||||
justify-content center
|
||||
align-items center
|
||||
position relative
|
||||
height anime-image-large-height
|
||||
margin-bottom content-padding
|
||||
|
||||
.episode-video
|
||||
width 100%
|
||||
max-width amv-large-width
|
||||
|
||||
.episode-not-available
|
||||
background reverse-light-color
|
||||
|
||||
.episode-arrow
|
||||
position absolute
|
||||
top 50%
|
||||
|
@ -152,6 +152,8 @@ const grid-cell-margin = 0.5rem
|
||||
|
||||
const user-pro-icon-size = 1.1rem
|
||||
|
||||
const amv-large-width = 854px
|
||||
|
||||
// Timings
|
||||
fade-speed = 150ms
|
||||
transition-speed = 150ms
|
||||
|
@ -90,7 +90,7 @@ const video-progress-clickable-height-buffer = 0.4rem
|
||||
line-height 1.5em
|
||||
|
||||
// Use a blurry shadow and a solid outline on each side
|
||||
text-shadow 0 0 0.5em rgba(0, 0, 0, 0.8), -1px -1px 0 black, 1px -1px 0 black, -1px 1px 0 black, 1px 1px 0 black
|
||||
text-shadow 0 0 0.5em rgba(0, 0, 0, 0.7), -1px -1px 0 black, 1px -1px 0 black, -1px 1px 0 black, 1px 1px 0 black
|
||||
|
||||
::-webkit-media-controls
|
||||
display none !important
|
1102
subtitles/anime/VhRKhKimR/10.en.vtt
Normal file
1102
subtitles/anime/VhRKhKimR/10.en.vtt
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user