Implemented anime relations
This commit is contained in:
parent
011ca84bd0
commit
07cb7dd64e
@ -26,6 +26,19 @@ func main() {
|
||||
animeID := mediaRelation.Relationships.Source.Data.ID
|
||||
destinationAnimeID := mediaRelation.Relationships.Destination.Data.ID
|
||||
|
||||
// Confirm that the anime IDs are valid
|
||||
exists, _ := arn.DB.Exists("Anime", animeID)
|
||||
|
||||
if !exists {
|
||||
continue
|
||||
}
|
||||
|
||||
exists, _ = arn.DB.Exists("Anime", destinationAnimeID)
|
||||
|
||||
if !exists {
|
||||
continue
|
||||
}
|
||||
|
||||
fmt.Printf(
|
||||
"%s %s has %s which is %s %s\n",
|
||||
mediaRelation.Relationships.Source.Data.Type,
|
||||
@ -35,6 +48,7 @@ func main() {
|
||||
destinationAnimeID,
|
||||
)
|
||||
|
||||
// Add anime to the global map
|
||||
relationsList, found := relations[animeID]
|
||||
|
||||
if !found {
|
||||
|
@ -2,6 +2,7 @@ package anime
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"sort"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
@ -66,6 +67,17 @@ func Get(ctx *aero.Context) string {
|
||||
arn.SortUsersLastSeen(friends)
|
||||
}
|
||||
|
||||
// Sort relations by start date
|
||||
relations := anime.Relations()
|
||||
|
||||
if relations != nil {
|
||||
items := relations.Items
|
||||
|
||||
sort.Slice(items, func(i, j int) bool {
|
||||
return items[i].Anime().StartDate < items[j].Anime().StartDate
|
||||
})
|
||||
}
|
||||
|
||||
// Open Graph
|
||||
description := anime.Summary
|
||||
|
||||
|
@ -3,6 +3,9 @@ component Anime(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]*
|
||||
if anime.Image.Small != ""
|
||||
.anime-image-container
|
||||
img.anime-cover-image(src=anime.Image.Small, alt=anime.Title.Canonical)
|
||||
|
||||
if anime.StartDate != ""
|
||||
.anime-start-date(title="Start date: " + anime.StartDate)= anime.StartDate[:4]
|
||||
|
||||
.space
|
||||
|
||||
@ -35,21 +38,6 @@ component Anime(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]*
|
||||
Icon("plus")
|
||||
span Add to collection
|
||||
|
||||
if len(friends) > 0
|
||||
h3.anime-section-name Friends
|
||||
|
||||
.anime-friends
|
||||
.user-avatars
|
||||
each friend in friends
|
||||
if friend.Nick != ""
|
||||
if friend.IsActive()
|
||||
.mountable
|
||||
FriendEntry(friend, listItems)
|
||||
else
|
||||
.mountable
|
||||
.inactive-user
|
||||
FriendEntry(friend, listItems)
|
||||
|
||||
h3.anime-section-name Ratings
|
||||
.anime-rating-categories
|
||||
.anime-rating-category(title=toString(anime.Rating.Overall))
|
||||
@ -68,6 +56,32 @@ component Anime(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]*
|
||||
.anime-rating-category-name Soundtrack
|
||||
Rating(anime.Rating.Soundtrack)
|
||||
|
||||
if len(friends) > 0
|
||||
h3.anime-section-name Friends
|
||||
|
||||
.anime-friends
|
||||
.user-avatars
|
||||
each friend in friends
|
||||
if friend.Nick != ""
|
||||
if friend.IsActive()
|
||||
.mountable
|
||||
FriendEntry(friend, listItems)
|
||||
else
|
||||
.mountable
|
||||
.inactive-user
|
||||
FriendEntry(friend, listItems)
|
||||
|
||||
if anime.Relations() != nil && len(anime.Relations().Items) > 0
|
||||
h3.anime-section-name Relations
|
||||
.anime-relations
|
||||
each relation in anime.Relations().Items
|
||||
a.anime-relation.ajax(href=relation.Anime().Link(), title=relation.Anime().Title.Canonical)
|
||||
img.anime-relation-image.lazy(data-src=relation.Anime().Image.Tiny, alt=relation.Anime().Title.Canonical)
|
||||
.anime-relation-type= relation.HumanReadableType()
|
||||
.anime-relation-year
|
||||
if relation.Anime().StartDate != ""
|
||||
span= relation.Anime().StartDate[:4]
|
||||
|
||||
if len(anime.Trailers) > 0 && anime.Trailers[0].Service == "Youtube" && anime.Trailers[0].ServiceID != ""
|
||||
h3.anime-section-name Video
|
||||
.anime-trailer.video-container
|
||||
@ -156,19 +170,6 @@ component Anime(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]*
|
||||
//- if providers.Nyaa && providers.Nyaa.episodes !== undefined
|
||||
//- span(class=providers.Nyaa.episodes === 0 ? "entry-error" : "entry-ok")= providers.Nyaa.episodes + " eps"
|
||||
|
||||
if len(tracks) > 0
|
||||
h3.anime-section-name Tracks
|
||||
.sound-tracks
|
||||
each track in tracks
|
||||
SoundTrack(track)
|
||||
|
||||
if anime.Characters() != nil && len(anime.Characters().Items) > 0
|
||||
h3.anime-section-name Characters
|
||||
.characters
|
||||
each character in anime.Characters().Items
|
||||
if character.Character() != nil
|
||||
Character(character.Character())
|
||||
|
||||
h3.anime-section-name Popularity
|
||||
.anime-rating-categories
|
||||
.anime-rating-category
|
||||
@ -187,6 +188,19 @@ component Anime(anime *arn.Anime, friends []*arn.User, listItems map[*arn.User]*
|
||||
.anime-rating-category-name Dropped
|
||||
.anime-rating= anime.Popularity.Dropped
|
||||
|
||||
if len(tracks) > 0
|
||||
h3.anime-section-name Tracks
|
||||
.sound-tracks
|
||||
each track in tracks
|
||||
SoundTrack(track)
|
||||
|
||||
if anime.Characters() != nil && len(anime.Characters().Items) > 0
|
||||
h3.anime-section-name Characters
|
||||
.characters
|
||||
each character in anime.Characters().Items
|
||||
if character.Character() != nil
|
||||
Character(character.Character())
|
||||
|
||||
if len(anime.Episodes().Items) > 0
|
||||
if episodesReversed
|
||||
h3.anime-section-name Latest episodes
|
||||
|
@ -9,9 +9,15 @@
|
||||
font-weight bold
|
||||
|
||||
.anime-image-container
|
||||
horizontal
|
||||
justify-content center
|
||||
align-items flex-start
|
||||
vertical
|
||||
justify-content flex-start
|
||||
align-items center
|
||||
|
||||
.anime-start-date
|
||||
font-size 0.7rem
|
||||
line-height 1.7em
|
||||
opacity 0.65
|
||||
margin-top 0.5rem
|
||||
|
||||
.anime-cover-image
|
||||
width 142px
|
||||
|
24
pages/anime/relation.scarlet
Normal file
24
pages/anime/relation.scarlet
Normal file
@ -0,0 +1,24 @@
|
||||
.anime-relations
|
||||
horizontal-wrap
|
||||
|
||||
.anime-relation
|
||||
anime-mini-item
|
||||
vertical
|
||||
|
||||
.anime-relation-image
|
||||
anime-mini-item-image
|
||||
|
||||
.anime-relation-type,
|
||||
.anime-relation-year
|
||||
font-size 0.7rem
|
||||
line-height 1.7em
|
||||
text-align center
|
||||
color text-color
|
||||
opacity 0.8
|
||||
|
||||
.anime-relation-type
|
||||
margin-top 0.2rem
|
||||
|
||||
.anime-relation-year
|
||||
font-size 0.6rem
|
||||
opacity 0.65
|
@ -3,7 +3,7 @@
|
||||
justify-content center
|
||||
|
||||
.profile-watching-list-item
|
||||
margin 0.25rem
|
||||
anime-mini-item
|
||||
|
||||
.profile-watching-list-item-image
|
||||
anime-cover-image-mini
|
||||
anime-mini-item-image
|
@ -9,7 +9,7 @@
|
||||
horizontal-wrap
|
||||
|
||||
.sound-track-anime-list-item
|
||||
//
|
||||
anime-mini-item
|
||||
|
||||
.sound-track-anime-list-item-image
|
||||
anime-cover-image-mini
|
||||
anime-mini-item-image
|
@ -42,7 +42,10 @@ mixin clip-long-text
|
||||
white-space nowrap
|
||||
text-overflow ellipsis
|
||||
|
||||
mixin anime-cover-image-mini
|
||||
mixin anime-mini-item
|
||||
margin 0.25rem
|
||||
|
||||
mixin anime-mini-item-image
|
||||
width 55px !important
|
||||
height 78px !important
|
||||
border-radius 2px
|
||||
|
Loading…
Reference in New Issue
Block a user