Creating new Media filter rules - should I use SuperTool for these?

I’m thinking of creating a set of filter rules, partly because I think they might be useful to me and maybe to others, but also just as a way to learn how to do it.

The rules I have in mind are these:

Media for people matching the <filter>
Media for events matching the <filter>
Media for sources matching the <filter>
Media for citations matching the <filter>

and these:

People with media matching the <filter>
Events with media matching the <filter>
Sources with media matching the <filter>
Citations with media matching the <filter>

There seem to be some existing filter rules that I can use as starting points. But I wonder, has anyone already created anything similar in SuperTool, that I could learn from or use as a starting point? I have not used it yet but thought this might be a good time to try. I have only just started reading the documentation and thought I should ask before investing more time.

Thanks for any advice.

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]

SuperTool-People - People with media matching filter - Example



my_media_filter = filter("90. Attribut['Tags', {'Individus': 'Communiant'}] - 090p", namespace="Media")

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







These filters could be easily derived from the previous one.