Filter programmatically the Product Gallery

did you ever figure this out ?