fix: address code review findings (consolidate slice helpers, correct bootleg comment)
This commit is contained in:
@@ -48,10 +48,13 @@ type TelegramConfig struct {
|
||||
|
||||
// ScannerConfig holds scanner engine parameters.
|
||||
//
|
||||
// Bootleg/Compilation filtering is intentionally unconditional: bootlegs,
|
||||
// promotions, and pseudo-releases are always excluded (musicbrainz/api.go),
|
||||
// and compilations are always included. These are not user-toggleable, so
|
||||
// there are no corresponding config fields.
|
||||
// Type filtering is handled in musicbrainz/api.go, not here: only Album/Single/EP
|
||||
// primary types (and release groups whose secondary types include Single/EP/Compilation)
|
||||
// are included. Bootlegs are not explicitly excluded — a release group whose primary
|
||||
// type is an included type but whose secondary types include "Bootleg" will still pass
|
||||
// through and may be reported as missing. Compilations are included by default but can
|
||||
// be excluded per-artist via artist_settings.ignore_compilations. These behaviours are
|
||||
// not user-toggleable at the global config level, so there are no corresponding config fields.
|
||||
type ScannerConfig struct {
|
||||
FuzzyThreshold float64 `yaml:"fuzzy_threshold"`
|
||||
}
|
||||
|
||||
@@ -94,10 +94,9 @@ func FilterReleaseGroups(groups []ReleaseGroup, opts FilterOptions) []ReleaseGro
|
||||
return filtered
|
||||
}
|
||||
|
||||
// hasSecondaryType reports whether any of the release group's secondary types
|
||||
// matches one of the provided values.
|
||||
func hasSecondaryType(rg ReleaseGroup, wanted ...string) bool {
|
||||
for _, s := range rg.SecondaryTypes {
|
||||
// hasSliceType reports whether the slice contains any of the wanted values.
|
||||
func hasSliceType(types []string, wanted ...string) bool {
|
||||
for _, s := range types {
|
||||
for _, w := range wanted {
|
||||
if s == w {
|
||||
return true
|
||||
@@ -107,6 +106,12 @@ func hasSecondaryType(rg ReleaseGroup, wanted ...string) bool {
|
||||
return false
|
||||
}
|
||||
|
||||
// hasSecondaryType reports whether any of the release group's secondary types
|
||||
// matches one of the provided values.
|
||||
func hasSecondaryType(rg ReleaseGroup, wanted ...string) bool {
|
||||
return hasSliceType(rg.SecondaryTypes, wanted...)
|
||||
}
|
||||
|
||||
// IsTypeIncluded returns true if the given primary type is in the base
|
||||
// included set (Album/Single/EP).
|
||||
func IsTypeIncluded(releaseType string) bool {
|
||||
|
||||
@@ -152,18 +152,6 @@ func SyncArtistDiscography(
|
||||
return releases, nil
|
||||
}
|
||||
|
||||
// hasSliceType reports whether the slice contains the wanted value. It mirrors
|
||||
// hasSecondaryType in api.go but operates on the persisted []string form read
|
||||
// back from external_releases (cache-hit path).
|
||||
func hasSliceType(types []string, wanted string) bool {
|
||||
for _, t := range types {
|
||||
if t == wanted {
|
||||
return true
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
// getArtistFilterOptions reads per-artist type filtering preferences.
|
||||
// Defaults to no filtering if artist_settings row doesn't exist.
|
||||
// artistID is the Navidrome artist ID (artist_settings.id), not the MusicBrainz ID.
|
||||
|
||||
Reference in New Issue
Block a user