Added short synopsis diff
This commit is contained in:
parent
1910b3c2d8
commit
65851b9128
@ -12,7 +12,7 @@ import (
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
const maxCompareMALEntries = 10
|
||||
const maxCompareMALEntries = 20
|
||||
|
||||
// CompareMAL ...
|
||||
func CompareMAL(ctx *aero.Context) string {
|
||||
@ -60,7 +60,7 @@ func CompareMAL(ctx *aero.Context) string {
|
||||
malAnime := obj.(*mal.Anime)
|
||||
var differences []animediff.Difference
|
||||
|
||||
// Compare canonical titles
|
||||
// Canonical title
|
||||
if anime.Title.Canonical != malAnime.Title {
|
||||
differences = append(differences, &animediff.CanonicalTitle{
|
||||
TitleA: anime.Title.Canonical,
|
||||
@ -68,6 +68,7 @@ func CompareMAL(ctx *aero.Context) string {
|
||||
})
|
||||
}
|
||||
|
||||
// Japanese title
|
||||
if anime.Title.Japanese != malAnime.JapaneseTitle {
|
||||
differences = append(differences, &animediff.JapaneseTitle{
|
||||
TitleA: anime.Title.Japanese,
|
||||
@ -75,6 +76,14 @@ func CompareMAL(ctx *aero.Context) string {
|
||||
})
|
||||
}
|
||||
|
||||
// Synopsis
|
||||
if len(anime.Summary) < len(malAnime.Synopsis) {
|
||||
differences = append(differences, &animediff.ShorterSynopsis{
|
||||
SynopsisA: anime.Summary,
|
||||
SynopsisB: malAnime.Synopsis,
|
||||
})
|
||||
}
|
||||
|
||||
// Compare genres
|
||||
hashA := utils.HashStringsNoOrder(anime.Genres)
|
||||
hashB := utils.HashStringsNoOrder(malAnime.Genres)
|
||||
|
@ -43,3 +43,4 @@
|
||||
|
||||
.data-comparison-difference-detail
|
||||
flex 1
|
||||
padding 0.5rem 0.75rem
|
||||
|
22
utils/animediff/LongerSynopsis.go
Normal file
22
utils/animediff/LongerSynopsis.go
Normal file
@ -0,0 +1,22 @@
|
||||
package animediff
|
||||
|
||||
// ShorterSynopsis describes differing Japanese titles.
|
||||
type ShorterSynopsis struct {
|
||||
SynopsisA string
|
||||
SynopsisB string
|
||||
}
|
||||
|
||||
// String returns the description.
|
||||
func (diff *ShorterSynopsis) String() string {
|
||||
return "Synopsis is shorter"
|
||||
}
|
||||
|
||||
// DetailsA shows the details for the first anime.
|
||||
func (diff *ShorterSynopsis) DetailsA() string {
|
||||
return diff.SynopsisA
|
||||
}
|
||||
|
||||
// DetailsB shows the details for the second anime.
|
||||
func (diff *ShorterSynopsis) DetailsB() string {
|
||||
return diff.SynopsisB
|
||||
}
|
Loading…
Reference in New Issue
Block a user