Page 1 of 1

AMC -> Is it possible to ask AMC to use a Post-Process script like in GUI?

Posted: 26 Jan 2026, 08:08
by FTW
Hello,

so I am not sure if the AMC already use the Post-Process Script I set in Filebot like(Relocate Radarr, etc) if not, how do I ask it to use the script??

Thanks

Re: AMC -> Is it possible to ask AMC to use a Post-Process script like in GUI?

Posted: 26 Jan 2026, 08:39
by rednoah
Yes, your --apply options apply for both simple -rename commands as well as -script commands internally call -rename in some fashion. If in doubt, I recommend doing a test run and reading the console output.

:arrow: [DOCS] --apply post-processing features › Apply Post-Processing Features via the --apply option from Terminal

Re: AMC -> Is it possible to ask AMC to use a Post-Process script like in GUI?

Posted: 26 Jan 2026, 09:15
by FTW
okk so I add --apply the.script.name.I.put.in.post-process?

I find out that the code I put in the Post-process are in a single file (using jlesage docker)
file -> prefs.properties -> net/filebot/ui/rename/scripts/1702741369={"@type"\:"Script","id"\:"1702741369","name"\:"Refresh Sonarr","code"\:"def host \= 'localhost'\\ndef port \= 8989\\ndef auth \= 'api_key'\\n \\ndef ids \= model.findAll{ it.type \=~ /Episode/ }.findResults{ it.tvdbId } as Set\\n\\nids.each{ id ->\\n\\tdef r \= curl \\"http\://${host}\:${port}/api/v3/series?tvdbId\=${id}\\", 'X-Api-Key'\: auth\\n\\tr.each{ s ->\\n\\t\\tcurl \\"http\://${host}\:${port}/api/v3/command\\", [name\: 'rescanSeries', seriesId\: s.id], 'X-Api-Key'\: auth\\n\\t}\\n}\\n"}

so in that case, I use --apply Refresh Sonarr ??

Re: AMC -> Is it possible to ask AMC to use a Post-Process script like in GUI?

Posted: 26 Jan 2026, 09:34
by rednoah
:?: Are you using the GUI or the CLI?

:idea: If you're using the CLI then you need to pass your script via the --apply command-line option, either inline as parameter value or via a file path to your script file.

:idea: You notably cannot reference custom post-processing scripts that you have created in the GUI from the CLI. You can however specify the same external script file in both GUI and CLI if you want to use the same code in both GUI and CLI.

:arrow: [DOCS] Custom Post-Processing Scripts › Add Post-Processing Scripts via the --apply option from Terminal

Re: AMC -> Is it possible to ask AMC to use a Post-Process script like in GUI?

Posted: 26 Jan 2026, 09:41
by FTW
ok so in short I have to put this code in a file?

Groovy: Select all

{ source, target ->

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
	}
}
and --apply path/filename.ext to use it so?

Re: AMC -> Is it possible to ask AMC to use a Post-Process script like in GUI?

Posted: 26 Jan 2026, 09:52
by rednoah
Yep, that's how I would do it:

Shell: Select all

--apply "/path/to/Refresh-Sonarr.groovy"

Re: AMC -> Is it possible to ask AMC to use a Post-Process script like in GUI?

Posted: 26 Jan 2026, 10:37
by FTW
alright thanks

Trying to create a post-Process script to as *arr to import the movies/shows

in that code

Groovy: Select all

{ source, target ->

    def importPath = target.dir.path

    // ---------- TV SHOWS → Sonarr ----------
    if (model.any{ it.type =~ /Episode/ }) {

        def host = '127.0.0.1'
        def port = 8989
        def auth = 'SONARR_API_KEY'

        curl "http://${host}:${port}/api/v3/command",
             [
                 name: 'DownloadedEpisodesScan',
                 path: importPath,
                 importMode: 'Move',
                 downloadClientId: 'FileBot'
             ],
             'X-Api-Key': auth
    }

    // ---------- MOVIES → Radarr ----------
    if (model.any{ it.type =~ /Movie/ }) {

        def host = '127.0.0.1'
        def port = 7878
        def auth = 'RADARR_API_KEY'

        curl "http://${host}:${port}/api/v3/command",
             [
                 name: 'DownloadedMoviesScan',
                 path: importPath,
                 importMode: 'Move',
                 downloadClientId: 'FileBot'
             ],
             'X-Api-Key': auth
    }
}
do you see something wrong before I test it? I am not sure about the target.dir.path if its the good one

Thanks in advance

Re: AMC -> Is it possible to ask AMC to use a Post-Process script like in GUI?

Posted: 26 Jan 2026, 18:55
by rednoah
:arrow: You'll want to run tests to see if it works.

:idea: target.dir.path is the path to the folder where the file at hand was moved or copied.