def host = '127.0.0.1'
def port = 8310
def auth = 'YOUR_API_KEY'
def ids = model.findAll{ it.type =~ /Movie/ }.findResults{ it.tmdbId } as Set
ids.each{ id ->
def r = curl "http://${host}:${port}/api/v3/movie?tmdbId=${id}", 'X-Api-Key': auth
r.each{ m ->
curl "http://${host}:${port}/api/v3/command", [name: 'rescanMovie', movieId: m.id], 'X-Api-Key': auth
}
}