mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
Various bug fixes (#2935)
* Sort scene/image/gallery tags by name * Calculate md5 if missing * Prevent multiple folder create logs
This commit is contained in:
@@ -14,6 +14,39 @@ type Fingerprint struct {
|
||||
|
||||
type Fingerprints []Fingerprint
|
||||
|
||||
func (f Fingerprints) Equals(other Fingerprints) bool {
|
||||
if len(f) != len(other) {
|
||||
return false
|
||||
}
|
||||
|
||||
for _, ff := range f {
|
||||
found := false
|
||||
for _, oo := range other {
|
||||
if ff == oo {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if !found {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// For returns a pointer to the first Fingerprint element matching the provided type.
|
||||
func (f Fingerprints) For(type_ string) *Fingerprint {
|
||||
for _, fp := range f {
|
||||
if fp.Type == type_ {
|
||||
return &fp
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (f Fingerprints) Get(type_ string) interface{} {
|
||||
for _, fp := range f {
|
||||
if fp.Type == type_ {
|
||||
@@ -59,5 +92,5 @@ func (f Fingerprints) AppendUnique(o Fingerprint) Fingerprints {
|
||||
|
||||
// FingerprintCalculator calculates a fingerprint for the provided file.
|
||||
type FingerprintCalculator interface {
|
||||
CalculateFingerprints(f *BaseFile, o Opener) ([]Fingerprint, error)
|
||||
CalculateFingerprints(f *BaseFile, o Opener, useExisting bool) ([]Fingerprint, error)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user