I’ve done that filter as a regular filter but due to some limitations, it is not a very clean filter (I have to enter the name of the media filter in a box, it’s impossible to select it directly as for other match <filter> filters).
If I’d to recreate it now I’ll do that using SuperTool and its possibility to acces filters in different namespaces. Something like that which is looking for people with a picture of their first communion comparing their linked medias to results of a media filter that searches for media tagged “First Communion”:
[Gramps SuperTool script file]
version=1
[title]
SuperTool-People - People with media matching filter - Example
[category]
People
[initial_statements]
# https://gramps.discourse.group/t/creating-new-filter-rules-should-i-use-supertool-for-these/3171
my_media_filter = filter("90. Attribut['Tags', {'Individus': 'Communiant'}] - 090p", namespace="Media")
print('======================================')
[statements]
found = False
for linked_media in obj.media_list:
linked_media_obj = db.get_media_from_handle(linked_media.ref)
if my_media_filter(linked_media_obj):
print(name, ': exist - ', linked_media_obj.desc)
found = True
[filter]
found
[expressions]
name
[scope]
all
[unwind_lists]
False
[commit_changes]
False
[summary_only]
False
These filters could be easily derived from the previous one.