Add Post-Processing Scripts via Rename Settings
You can add custom post-processing scripts via








Add Post-Processing Scripts via the --apply option from Terminal
--apply can be added to -rename, -find and -mediainfo commands to run your custom code on newly renamed files or previously renamed files.Shell: Select all
--apply '{ source, target, metadata -> println "$source | $target | $metadata" }'
Shell: Select all
--apply /path/to/apply.groovy
Example Scripts
e.g. Run Command on each newly processed file:
Groovy: Select all
{ source, target ->
system '/path/to/script.sh', source, target
}
e.g. Refresh Plex via a HTTP request with X-Plex-Token authentication:
Groovy: Select all
def host = '127.0.0.1'
def auth = 'YOUR_PLEX_TOKEN'
curl "http://${host}:32400/library/sections/all/refresh?X-Plex-Token=${auth}"
e.g. Refresh Emby / Jellyfin via a HTTP request:
Groovy: Select all
def host = '127.0.0.1'
def auth = 'YOUR_API_KEY'
curl "http://${host}:8096/Library/Refresh?api_key=${auth}", [:]
e.g. Refresh Kodi via a HTTP request:
Groovy: Select all
def host = '127.0.0.1'
def port = 8080
curl "http://${host}:${port}/jsonrpc", [jsonrpc: '2.0', method: 'VideoLibrary.Scan', id: 1]
e.g. Refresh Radarr via HTTP requests:
Groovy: Select all
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
}
}
e.g. Refresh Sonarr via HTTP requests:
Groovy: Select all
def host = '127.0.0.1'
def port = 8989
def auth = 'YOUR_API_KEY'
def ids = model.findAll{ it.type =~ /Episode/ }.findResults{ it.tvdbId } as Set
ids.each{ id ->
def r = curl "http://${host}:${port}/api/v3/series?tvdbId=${id}", 'X-Api-Key': auth
r.each{ s ->
curl "http://${host}:${port}/api/v3/command", [name: 'rescanSeries', seriesId: s.id], 'X-Api-Key': auth
}
}
e.g. Send alerts to a Discord channel via Server Settings ➔ Integrations ➔ Webhooks:
Groovy: Select all
{ source, target ->
curl 'https://discord.com/api/webhooks/YOUR_WEBHOOK', [content: """```[${action}] from [${source.name}] to [${target.name}]```"""]
}
e.g. Send alerts to a Mattermost channel via Incoming Webhooks:
Groovy: Select all
{ source, target ->
curl 'http://YOUR_SITE/hooks/YOUR_WEBHOOK', [text: """```[${action}] from [${source.name}] to [${target.name}]```"""]
}
e.g. Run osascript to set the Finder Comments to the original file name:
Groovy: Select all
{ source, target ->
// reveal file in Finder
system 'open', '-R', target
// set Finder Comment
system 'osascript', '-e', """
tell app "Finder"
set f to (POSIX file "$target" as alias)
set c to "$original"
set comment of f to c
end tell
"""
}