Episode page improvements
This commit is contained in:
parent
20a4e31999
commit
2b8288e208
@ -40,6 +40,7 @@ func main() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
defer discord.Close()
|
defer discord.Close()
|
||||||
|
defer arn.Node.Close()
|
||||||
|
|
||||||
// Receive events
|
// Receive events
|
||||||
discord.AddHandler(OnMessageCreate)
|
discord.AddHandler(OnMessageCreate)
|
||||||
|
@ -1,5 +1,3 @@
|
|||||||
const amv-large-width = 854px
|
|
||||||
|
|
||||||
.amvs
|
.amvs
|
||||||
vertical
|
vertical
|
||||||
|
|
||||||
|
@ -1,14 +1,34 @@
|
|||||||
package episode
|
package episode
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
"github.com/aerogo/aero"
|
"github.com/aerogo/aero"
|
||||||
"github.com/animenotifier/arn"
|
"github.com/animenotifier/arn"
|
||||||
"github.com/animenotifier/notify.moe/components"
|
"github.com/animenotifier/notify.moe/components"
|
||||||
"github.com/animenotifier/notify.moe/utils"
|
"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.
|
// Get renders the anime episode.
|
||||||
func Get(ctx *aero.Context) string {
|
func Get(ctx *aero.Context) string {
|
||||||
user := utils.GetUser(ctx)
|
user := utils.GetUser(ctx)
|
||||||
@ -33,11 +53,19 @@ func Get(ctx *aero.Context) string {
|
|||||||
return ctx.Error(http.StatusNotFound, "Anime episodes not found", err)
|
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)
|
episode, episodeIndex := animeEpisodes.Find(episodeNumber)
|
||||||
|
|
||||||
if episode == nil {
|
if episode == nil {
|
||||||
return ctx.Error(http.StatusNotFound, "Anime episode not found")
|
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
|
h1
|
||||||
a(href=anime.Link())= anime.Title.ByUser(user)
|
a(href=anime.Link())= anime.Title.ByUser(user)
|
||||||
|
|
||||||
if anime.ID == "GWyShKmiR" && episode.Number == 10
|
.episode-navigation-container
|
||||||
.widget-form.amv-page
|
if episodeIndex > 0
|
||||||
.video-container(id="stream-test")
|
.episode-arrow.episode-arrow-previous
|
||||||
video.video.lazy.action(data-action="toggleFullscreen", data-trigger="dblclick", data-id="stream-test")
|
a.light-button(href=anime.Link() + "/episode/" + strconv.Itoa(anime.Episodes().Items[episodeIndex - 1].Number), title="Previous episode")
|
||||||
source(data-src="https://arn.sfo2.cdn.digitaloceanspaces.com/videos/anime/GWyShKmiR/10.webm", data-type="video/webm")
|
RawIcon("chevron-left")
|
||||||
track(label="English", kind="subtitles", srclang="en", src="/subtitles/anime/GWyShKmiR/10.en.vtt", default)
|
|
||||||
|
|
||||||
VideoControls("stream-test", time.Duration(0))
|
.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)
|
||||||
|
|
||||||
br
|
VideoControls("stream-test", time.Duration(0))
|
||||||
else
|
else
|
||||||
.episode-view-image-container
|
.video-container.episode-not-available(title="Episode not available yet")
|
||||||
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))
|
//- 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))
|
//- 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
|
if episodeIndex < len(anime.Episodes().Items) - 1
|
||||||
.episode-arrow.episode-arrow-next
|
.episode-arrow.episode-arrow-next
|
||||||
a.light-button(href=anime.Link() + "/episode/" + strconv.Itoa(anime.Episodes().Items[episodeIndex + 1].Number), title="Next episode")
|
a.light-button(href=anime.Link() + "/episode/" + strconv.Itoa(anime.Episodes().Items[episodeIndex + 1].Number), title="Next episode")
|
||||||
RawIcon("chevron-right")
|
RawIcon("chevron-right")
|
||||||
|
|
||||||
h3.episode-view-number= "Episode " + strconv.Itoa(episode.Number)
|
h3.episode-view-number= "Episode " + strconv.Itoa(episode.Number)
|
||||||
|
|
||||||
|
@ -11,14 +11,20 @@
|
|||||||
font-size 0.9rem
|
font-size 0.9rem
|
||||||
half-opacity-text
|
half-opacity-text
|
||||||
|
|
||||||
.episode-view-image-container
|
.episode-navigation-container
|
||||||
horizontal
|
horizontal
|
||||||
justify-content center
|
justify-content center
|
||||||
align-items center
|
align-items center
|
||||||
position relative
|
position relative
|
||||||
height anime-image-large-height
|
|
||||||
margin-bottom content-padding
|
margin-bottom content-padding
|
||||||
|
|
||||||
|
.episode-video
|
||||||
|
width 100%
|
||||||
|
max-width amv-large-width
|
||||||
|
|
||||||
|
.episode-not-available
|
||||||
|
background reverse-light-color
|
||||||
|
|
||||||
.episode-arrow
|
.episode-arrow
|
||||||
position absolute
|
position absolute
|
||||||
top 50%
|
top 50%
|
||||||
|
@ -152,6 +152,8 @@ const grid-cell-margin = 0.5rem
|
|||||||
|
|
||||||
const user-pro-icon-size = 1.1rem
|
const user-pro-icon-size = 1.1rem
|
||||||
|
|
||||||
|
const amv-large-width = 854px
|
||||||
|
|
||||||
// Timings
|
// Timings
|
||||||
fade-speed = 150ms
|
fade-speed = 150ms
|
||||||
transition-speed = 150ms
|
transition-speed = 150ms
|
||||||
|
@ -90,7 +90,7 @@ const video-progress-clickable-height-buffer = 0.4rem
|
|||||||
line-height 1.5em
|
line-height 1.5em
|
||||||
|
|
||||||
// Use a blurry shadow and a solid outline on each side
|
// 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
|
::-webkit-media-controls
|
||||||
display none !important
|
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