Skip to content

Commit

Permalink
refactor: update non-bird image handling in BirdImageCache
Browse files Browse the repository at this point in the history
- Modified the nonBirdScientificNames map to be empty while retaining the infrastructure for future use.
- Adjusted debug logging to remove unnecessary details about image availability for non-bird species, improving clarity in log outputs.
- This change simplifies the fetch function in BirdImageCache while preparing for potential future enhancements.
  • Loading branch information
tphakala committed Dec 21, 2024
1 parent 08d19ca commit a2a3a3f
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions internal/imageprovider/imageprovider.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,13 @@ func (c *BirdImageCache) fetch(scientificName string) (BirdImage, error) {
log.Printf("Debug: Fetching image for species: %s", scientificName)
}

// This is set to empty for now
// Keep the infrastructure but make the list empty for now
nonBirdScientificNames := map[string]struct{}{}

/*nonBirdScientificNames := map[string]struct{}{
"Dog": {}, "Engine": {}, "Environmental": {}, "Fireworks": {},
"Gun": {}, "Human non-vocal": {}, "Human vocal": {}, "Human whistle": {},
"Noise": {}, "Power tools": {}, "Siren": {},
}*/

var imageProviderToUse ImageProvider

if _, isNonBird := nonBirdScientificNames[scientificName]; isNonBird {
if c.debug {
log.Printf("Debug: Using non-bird image provider for: %s (no images available for non-bird species)", scientificName)
log.Printf("Debug: Using non-bird image provider for: %s", scientificName)
}
imageProviderToUse = c.nonBirdImageProvider
} else {
Expand Down

0 comments on commit a2a3a3f

Please sign in to comment.