From 85f140fb188874936a8aea519b8eb0744f92a63e Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Sat, 8 Dec 2018 20:05:17 +0900 Subject: [PATCH] Added streaming test --- mixins/AMV.pixy | 13 +------- mixins/VideoControls.pixy | 13 ++++++++ pages/episode/episode.pixy | 63 ++++++++++++++++++++++---------------- 3 files changed, 51 insertions(+), 38 deletions(-) create mode 100644 mixins/VideoControls.pixy diff --git a/mixins/AMV.pixy b/mixins/AMV.pixy index 7377906a..bd85bfea 100644 --- a/mixins/AMV.pixy +++ b/mixins/AMV.pixy @@ -16,18 +16,7 @@ component AMVVideo(amv *arn.AMV) //- button.media-play-button //- RawIcon("play") - .video-controls - .video-progress-clickable - .video-progress-container - .video-progress - - .video-time= fmt.Sprintf("%d:%02d", int(amv.Info.Duration.Minutes()), int(amv.Info.Duration.Seconds()) % 60) - - //- button.video-control.action(data-action="like", data-trigger="click") - //- RawIcon("heart-o") - - button.video-control.action(data-action="toggleFullscreen", data-trigger="click", data-id=amv.ID, aria-label="Fullscreen") - RawIcon("fullscreen") + VideoControls(amv.ID, amv.Info.Duration) component AMVFooter(amv *arn.AMV, user *arn.User) .amv-footer diff --git a/mixins/VideoControls.pixy b/mixins/VideoControls.pixy new file mode 100644 index 00000000..ffac57f6 --- /dev/null +++ b/mixins/VideoControls.pixy @@ -0,0 +1,13 @@ +component VideoControls(containerId string, duration time.Duration) + .video-controls + .video-progress-clickable + .video-progress-container + .video-progress + + .video-time= fmt.Sprintf("%d:%02d", int(duration.Minutes()), int(duration.Seconds()) % 60) + + //- button.video-control.action(data-action="like", data-trigger="click") + //- RawIcon("heart-o") + + button.video-control.action(data-action="toggleFullscreen", data-trigger="click", data-id=containerId, aria-label="Fullscreen") + RawIcon("fullscreen") \ No newline at end of file diff --git a/pages/episode/episode.pixy b/pages/episode/episode.pixy index 9a57e8e3..acda5ebb 100644 --- a/pages/episode/episode.pixy +++ b/pages/episode/episode.pixy @@ -1,20 +1,30 @@ component AnimeEpisode(anime *arn.Anime, episode *arn.AnimeEpisode, episodeIndex int, user *arn.User) h1 a(href=anime.Link())= anime.Title.ByUser(user) - - .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") + + if anime.ID == "VhRKhKimR" && episode.Number == 10 + .widget-form.amv-page + .video-container(id="stream-test") + video.video.lazy.action(data-action="playVideo", data-trigger="click", data-media-id="stream-test") + source(data-src="https://arn.sfo2.cdn.digitaloceanspaces.com/videos/anime/VhRKhKimR/10.webm", data-type="video/webm") - 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)) + VideoControls("stream-test", time.Duration(0)) + + 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)) - 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") + 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) @@ -25,18 +35,19 @@ component AnimeEpisode(anime *arn.Anime, episode *arn.AnimeEpisode, episodeIndex if validate.DateTime(episode.AiringDate.Start) p.episode-view-airing-date span.utc-airing-date(data-start-date=episode.AiringDate.Start, data-end-date=episode.AiringDate.End, data-episode-number=episode.Number)= episode.AiringDate.StartDateHuman() - - if user != nil && user.Location.CountryName != "Japan" - .buttons - for serviceName, link := range episode.Links - a.button(href=link, title="Watch episode " + strconv.Itoa(episode.Number), target="_blank", rel="noopener") - Icon("eye") - span= serviceName + + if anime.ID != "VhRKhKimR" || episode.Number != 10 + if user != nil && user.Location.CountryName != "Japan" + .buttons + for serviceName, link := range episode.Links + a.button(href=link, title="Watch episode " + strconv.Itoa(episode.Number), target="_blank", rel="noopener") + Icon("eye") + span= serviceName + + //- a.button(href=arn.Nyaa.GetLink(anime, fmt.Sprintf("%02d", episode.Number)), title="Download episode " + strconv.Itoa(episode.Number), target="_blank", rel="noopener") + //- Icon("download") + //- span nyaa.si - //- a.button(href=arn.Nyaa.GetLink(anime, fmt.Sprintf("%02d", episode.Number)), title="Download episode " + strconv.Itoa(episode.Number), target="_blank", rel="noopener") - //- Icon("download") - //- span nyaa.si - - .footer - p Make sure to support the anime you're watching by buying officially released Blu-rays and merchandise. - p Anime Notifier provides links to external websites for convenience reasons. By clicking on these links you are leaving our site. Thus we can not, under no circumstances, be held responsible for the content on external websites. \ No newline at end of file + .footer + p Make sure to support the anime you're watching by buying officially released Blu-rays and merchandise. + p Anime Notifier provides links to external websites for convenience reasons. By clicking on these links you are leaving our site. Thus we can not, under no circumstances, be held responsible for the content on external websites. \ No newline at end of file