Added episodes and airing dates

This commit is contained in:
Eduard Urbach 2017-06-28 19:30:09 +02:00
parent 9bae97f9db
commit f4e9b31fb8
6 changed files with 76 additions and 2 deletions

View File

@ -61,6 +61,10 @@ func sync(data *kitsu.Anime) {
anime.Mappings = []*arn.Mapping{} anime.Mappings = []*arn.Mapping{}
} }
if anime.Episodes == nil {
anime.Episodes = []*arn.AnimeEpisode{}
}
// NSFW // NSFW
if attr.Nsfw { if attr.Nsfw {
anime.NSFW = 1 anime.NSFW = 1

View File

@ -144,6 +144,19 @@ component Anime(anime *arn.Anime, tracks []*arn.SoundTrack, user *arn.User)
each track in tracks each track in tracks
SoundTrack(track) SoundTrack(track)
if len(anime.Episodes) > 0
h3.anime-section-name Episodes
table
tbody
each episode in anime.Episodes
tr.episode
td.episode-number= episode.Number
td.episode-title= episode.Title.Japanese
td.episode-actions
a(href="https://translate.google.com/#ja/en/" + episode.Title.Japanese, target="_blank", rel="noopener")
RawIcon("google")
td.episode-airing-date-start= episode.AiringDate.StartDateHuman()
//- h3.anime-section-name Reviews //- h3.anime-section-name Reviews
//- p Coming soon. //- p Coming soon.

View File

@ -0,0 +1,21 @@
.episode
horizontal
.episode-number
flex-basis 3.2rem
// text-align right
.episode-title
flex 1
.episode-airing-date-start
flex-basis 270px
text-align right
< 800px
.episode-airing-date-start
display none
< 500px
.episode-actions
display none

View File

@ -0,0 +1,32 @@
package main
import (
"github.com/animenotifier/arn"
"github.com/fatih/color"
)
func main() {
// Get a stream of all anime
allAnime, err := arn.AllAnime()
if err != nil {
panic(err)
}
// Iterate over the stream
for _, anime := range allAnime {
if anime.Mappings == nil {
anime.Mappings = []*arn.Mapping{}
}
if anime.Episodes == nil {
anime.Episodes = []*arn.AnimeEpisode{}
}
err := anime.Save()
if err != nil {
color.Red("Error saving anime: %v", err)
}
}
}

View File

@ -36,6 +36,11 @@ mixin clip-long-text
white-space nowrap white-space nowrap
text-overflow ellipsis text-overflow ellipsis
mixin bg-dark-up
background-color transparent
:hover
background-color rgba(0, 0, 0, 0.015)
mixin light-up mixin light-up
filter brightness(0.4) saturate(1) filter brightness(0.4) saturate(1)
:hover :hover

View File

@ -19,5 +19,4 @@ th
tbody tbody
tr tr
:hover bg-dark-up
background-color rgba(0, 0, 0, 0.015)