Added check for diff ignores
This commit is contained in:
@ -2,6 +2,13 @@ package utils
|
||||
|
||||
import "github.com/OneOfOne/xxhash"
|
||||
|
||||
// HashString returns a hash of the string.
|
||||
func HashString(item string) uint64 {
|
||||
h := xxhash.NewS64(0)
|
||||
h.Write([]byte(item))
|
||||
return h.Sum64()
|
||||
}
|
||||
|
||||
// HashStringsNoOrder returns a hash of the string slice contents, ignoring order.
|
||||
func HashStringsNoOrder(items []string) uint64 {
|
||||
sum := uint64(0)
|
||||
|
@ -6,8 +6,13 @@ type CanonicalTitle struct {
|
||||
TitleB string
|
||||
}
|
||||
|
||||
// String returns the description.
|
||||
func (diff *CanonicalTitle) String() string {
|
||||
// Type returns the diff type.
|
||||
func (diff *CanonicalTitle) Type() string {
|
||||
return "CanonicalTitle"
|
||||
}
|
||||
|
||||
// Explanation returns the description.
|
||||
func (diff *CanonicalTitle) Explanation() string {
|
||||
return "Canonical titles are different"
|
||||
}
|
||||
|
||||
|
@ -8,8 +8,13 @@ type Genres struct {
|
||||
GenresB []string
|
||||
}
|
||||
|
||||
// String returns the description.
|
||||
func (diff *Genres) String() string {
|
||||
// Type returns the diff type.
|
||||
func (diff *Genres) Type() string {
|
||||
return "Genres"
|
||||
}
|
||||
|
||||
// Explanation returns the description.
|
||||
func (diff *Genres) Explanation() string {
|
||||
return "Genres are different"
|
||||
}
|
||||
|
||||
|
@ -2,7 +2,8 @@ package animediff
|
||||
|
||||
// Difference describes a difference between two anime.
|
||||
type Difference interface {
|
||||
String() string
|
||||
Type() string
|
||||
Explanation() string
|
||||
DetailsA() string
|
||||
DetailsB() string
|
||||
}
|
||||
|
@ -6,8 +6,13 @@ type JapaneseTitle struct {
|
||||
TitleB string
|
||||
}
|
||||
|
||||
// String returns the description.
|
||||
func (diff *JapaneseTitle) String() string {
|
||||
// Type returns the diff type.
|
||||
func (diff *JapaneseTitle) Type() string {
|
||||
return "JapaneseTitle"
|
||||
}
|
||||
|
||||
// Explanation returns the description.
|
||||
func (diff *JapaneseTitle) Explanation() string {
|
||||
return "Japanese titles are different"
|
||||
}
|
||||
|
||||
|
@ -1,22 +0,0 @@
|
||||
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
|
||||
}
|
27
utils/animediff/Synopsis.go
Normal file
27
utils/animediff/Synopsis.go
Normal file
@ -0,0 +1,27 @@
|
||||
package animediff
|
||||
|
||||
// Synopsis describes differing synopsis.
|
||||
type Synopsis struct {
|
||||
SynopsisA string
|
||||
SynopsisB string
|
||||
}
|
||||
|
||||
// Type returns the diff type.
|
||||
func (diff *Synopsis) Type() string {
|
||||
return "Synopsis"
|
||||
}
|
||||
|
||||
// Explanation returns the description.
|
||||
func (diff *Synopsis) Explanation() string {
|
||||
return "Synopsis is shorter"
|
||||
}
|
||||
|
||||
// DetailsA shows the details for the first anime.
|
||||
func (diff *Synopsis) DetailsA() string {
|
||||
return diff.SynopsisA
|
||||
}
|
||||
|
||||
// DetailsB shows the details for the second anime.
|
||||
func (diff *Synopsis) DetailsB() string {
|
||||
return diff.SynopsisB
|
||||
}
|
Reference in New Issue
Block a user