diff --git a/integrations/jikan/types.go b/integrations/jikan/types.go index 9dc1226..38af3c7 100644 --- a/integrations/jikan/types.go +++ b/integrations/jikan/types.go @@ -65,6 +65,9 @@ type Anime struct { Producers []NamedEntity `json:"producers"` Themes []NamedEntity `json:"themes"` Source string `json:"source"` + Background string `json:"background"` + Favorites int `json:"favorites"` + Members int `json:"members"` Demographics []NamedEntity `json:"demographics"` Licensors []NamedEntity `json:"licensors"` Broadcast struct { @@ -85,10 +88,22 @@ type Anime struct { } func (a Anime) ScoredByFormatted() string { - if a.ScoredBy == 0 { + return formatNumber(a.ScoredBy) +} + +func (a Anime) MembersFormatted() string { + return formatNumber(a.Members) +} + +func (a Anime) FavoritesFormatted() string { + return formatNumber(a.Favorites) +} + +func formatNumber(n int) string { + if n == 0 { return "" } - s := fmt.Sprintf("%d", a.ScoredBy) + s := fmt.Sprintf("%d", n) var res []string for i := len(s); i > 0; i -= 3 { start := i - 3 diff --git a/templates/anime.gohtml b/templates/anime.gohtml index 477a984..7a92dfa 100644 --- a/templates/anime.gohtml +++ b/templates/anime.gohtml @@ -3,7 +3,7 @@ {{if .WatchlistIDs}}{{end}} {{$anime := .Anime}} -
+
@@ -45,7 +45,7 @@
-
+

Synopsis

{{if $anime.Synopsis}}{{$anime.Synopsis}}{{else}}No synopsis available.{{end}}

{{if and $anime.Synopsis (gt (len $anime.Synopsis) 400)}} @@ -63,56 +63,120 @@ Read more {{end}} + {{if $anime.Background}} +
+

Background

+
+ {{$anime.Background}} +
+
+ {{end}}
-