When restricting CAA cover art by image type, an image that has both an included and an excluded type is downloaded anyway. The "Exclude" list is supposed to override the "Include" list, but it does not.
Steps to Reproduce
1. Options → Cover Art → Cover Art Archive: enable "Download only cover art images matching selected types".
2. Set Include = Front, Back. Set Exclude = Booklet, Spine (plus defaults).
3. Load release "We Came to Dance, Volume V" (MBID e8d4a459-87b4-425c-b582-b614b533ec15).
Expected Result
Only the plain Front image is downloaded. Images typed [Front, Booklet] and [Back, Spine] are skipped, because Booklet and Spine are in the Exclude list. The CAA types selector dialog states excluded types "will NEVER be used".
Actual Result
Three images are downloaded:
- [Front] (correct)
- [Front, Booklet] (should be excluded)
- [Back, Spine] (should be excluded)
Debug log confirms:
CAA image accepted: .../3606799120.jpg ['front', 'booklet']
CAA image accepted: .../3606845819.jpg ['back', 'spine']
Cause
In picard/coverart/providers/caa.py the accept test subtracts the excluded types from the include intersection instead of testing them against the image's full type set:
accepted = bool(
set(image['types']).intersection(self.included_types).difference(self.excluded_types)
)
So an excluded type only has an effect if it is also in the Include list, making the Exclude list almost powerless.
Fix
Accept an image only if it has at least one included type AND none of its types are excluded (exclude always wins).
https://community.metabrainz.org/t/artwork-downloads-from-caa/815842/