Added canonical title diff
This commit is contained in:
24
utils/AnimeGenresDiff.go
Normal file
24
utils/AnimeGenresDiff.go
Normal file
@ -0,0 +1,24 @@
|
||||
package utils
|
||||
|
||||
import "strings"
|
||||
|
||||
// AnimeGenresDiff describes differing genres.
|
||||
type AnimeGenresDiff struct {
|
||||
GenresA []string
|
||||
GenresB []string
|
||||
}
|
||||
|
||||
// String returns the description.
|
||||
func (diff *AnimeGenresDiff) String() string {
|
||||
return "Genres are different"
|
||||
}
|
||||
|
||||
// DetailsA shows the details for the first anime.
|
||||
func (diff *AnimeGenresDiff) DetailsA() string {
|
||||
return strings.Join(diff.GenresA, ", ")
|
||||
}
|
||||
|
||||
// DetailsB shows the details for the second anime.
|
||||
func (diff *AnimeGenresDiff) DetailsB() string {
|
||||
return strings.Join(diff.GenresB, ", ")
|
||||
}
|
22
utils/AnimeTitleDiff.go
Normal file
22
utils/AnimeTitleDiff.go
Normal file
@ -0,0 +1,22 @@
|
||||
package utils
|
||||
|
||||
// AnimeTitleDiff describes differing titles.
|
||||
type AnimeTitleDiff struct {
|
||||
TitleA string
|
||||
TitleB string
|
||||
}
|
||||
|
||||
// String returns the description.
|
||||
func (diff *AnimeTitleDiff) String() string {
|
||||
return "Titles are different"
|
||||
}
|
||||
|
||||
// DetailsA shows the details for the first anime.
|
||||
func (diff *AnimeTitleDiff) DetailsA() string {
|
||||
return diff.TitleA
|
||||
}
|
||||
|
||||
// DetailsB shows the details for the second anime.
|
||||
func (diff *AnimeTitleDiff) DetailsB() string {
|
||||
return diff.TitleB
|
||||
}
|
@ -1,35 +1,18 @@
|
||||
package utils
|
||||
|
||||
import (
|
||||
"strings"
|
||||
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/mal"
|
||||
)
|
||||
|
||||
// AnimeDiff describes a difference between two anime.
|
||||
type AnimeDiff interface {
|
||||
String() string
|
||||
DetailsA() string
|
||||
DetailsB() string
|
||||
}
|
||||
|
||||
type AnimeGenresDiff struct {
|
||||
GenresA []string
|
||||
GenresB []string
|
||||
}
|
||||
|
||||
func (diff *AnimeGenresDiff) String() string {
|
||||
return "Genres are different"
|
||||
}
|
||||
|
||||
func (diff *AnimeGenresDiff) DetailsA() string {
|
||||
return strings.Join(diff.GenresA, ", ")
|
||||
}
|
||||
|
||||
func (diff *AnimeGenresDiff) DetailsB() string {
|
||||
return strings.Join(diff.GenresB, ", ")
|
||||
}
|
||||
|
||||
// MALComparison encapsulates the difference between an ARN anime and a MAL anime.
|
||||
type MALComparison struct {
|
||||
Anime *arn.Anime
|
||||
MALAnime *mal.Anime
|
||||
|
Reference in New Issue
Block a user