I propose a change to add an additional set of configuration settings and processing logic to identify which image types to exclude for download.
This change adds new user settings to indicate whether selected image types should be excluded from downloads from CAA and the list of image types to be excluded, similar to the option to only include selected image types. Additional logic is applied to the list of images selected for download, and any images with a type intersecting the user's "exclusion" type list are removed from the download list.
Generally speaking, the current logic for determining whether to download an image is (where the image is downloaded when "types" evaluates to True):
if self.restrict_types:
# only keep enabled caa types
types = set(image["types"]).intersection(set(self.caa_types))
else:
types = True
This proposed change adds a further check for exclusion, as:
if self.restrict_types:
# only keep enabled caa types
types = set(image["types"]).intersection(set(self.caa_types))
else:
types = True
if types and self.omit_types:
# exclude selected caa types
types = not set(image["types"]).intersection(set(self.caa_types_to_omit))
In short, a file will be downloaded if its "type" list intersects the user-specified "download types" list unless the file's "type" list intersects with the user-specified "exclude types" list.
rdswift's pull request: https://github.com/metabrainz/picard/pull/914