Does PostProcess expect to autorun after rename ?

All your suggestions, requests and ideas for future development
Post Reply
n1n1
Posts: 7
Joined: 08 Jan 2026, 12:57

Does PostProcess expect to autorun after rename ?

Post by n1n1 »

Hello

I am a little bit confused with post process custom script, and some options here.
I thought every post process options I ticked will automatically run after renaming files when I click on rename button, but it is not.

I am using custom script to create a nfo file.
When I test it by Ctrl + R in script editor window, my custom script runs fine, and my nfo file is well created with proper content at the same location of my media file.
But when I select my episode, clic on fetch data from tvdb, and clic rename, only the media file is renamed and no file is created by post processing script :(

I understood xattr data must be present, but I assume those data are retrieved while renaming ?
Even if try to rename same file again and again, no file is created, except if I select posts process options, my script and do Ctrl + R.

Does it work only in command line mode ?
If not, can you help me in checking prerequisites or tell me what I'm doing wrong ?

The only 3 options that works automatically are export .xattr folders, update timestamp and fetch thumbnails, all others options remain uneffective in the UI.
I have the following warning ONLY when I tick my script.

Error: Select all

Jan 08, 2026 10:45:07 PM java.util.stream.ForEachOps$ForEachOp$OfRef accept
AVERTISSEMENT: Undefined Variable: java.lang.NullPointerException: Cannot invoke method or() on null object at Builder$1::toString < ScriptBaseClass::write < ScriptBaseClass::XML < ApplyClosure::apply < ApplyStep::apply (D:\Tv Shows\Violet Evergarden (2018) [tvdbid=330139]\Specials\Violet Evergarden (2018) - S00E01 - OVA - Surely, Someday You Will Understand Love.mkv)
If I select export nfo or any other uneffective option, I have no message in log, no warning, it justs does not run.

I am using :

Code: Select all

FileBot 5.2.0 (r10714)
JNA Native: 7.0.0
MediaInfo: 25.07
7-Zip-JBinding: 16.02
Tools: fpcalc/1.5.0
Extended Attributes: OK
Unicode Filesystem: OK
Script Bundle: 2025-09-04 (r1016)
Groovy: 4.0.28
JRE: OpenJDK Runtime Environment 21.0.4
JVM: OpenJDK 64-Bit Server VM
CPU/MEM: 24 Core / 17 GB Max Memory / 206 MB Used Memory
OS: Windows 11 (amd64)
the episode rename template used in my test is {~emby.id}
my episode is in D:\Tv Shows\Violet Evergarden (2018) [tvdbid=330139]\Specials

my script is

Groovy: Select all

{ source, target ->
	XML(target.dir / target.nameWithoutExtension + '.nfo') {
          '?xml version="1.0" encoding="utf-8" standalone="yes"?'{}
		episodedetails {
			plot()
			outline()
			lockdata(false)
			lockedfields(SortParentIndexNumber|SortIndexNumber)
			dateadded()
			title($t)
			rating()
			year($y)
			sorttitle($t)
			imdbid()
			tvdbid($episode.info.raw.id)
			runtime($runtime)
			'uniqueid type="tvdb"'($episode.info.raw.id)
			'uniqueid type="imdb"'()
			episode($e00)
			season($s00)
			aired($d)
			displayepisode($episode.info.raw.airsBeforeEpisode)
			displayseason($episode.info.raw.airsBeforeSeason)
			fileinfo {
				streamdetails {
					target.mediaInfo.Video.each{ v ->
						video {
							codec(v.'Encoded_Library/Name' ?: v.'CodecID/Hint' ?: v.'Format')
							aspect(v.'DisplayAspectRatio')
							width(v.'Width')
							height(v.'Height')
						}
					}
					target.mediaInfo.Audio.each{ a ->
						audio {
							codec(a.'CodecID/Hint' ?: a.'Format')
							language(a.'Language/String3')
							channels(a.'Channel(s)_Original' ?: a.'Channel(s)')
						}
					}
				}
			}
		}
	}
}
User avatar
rednoah
The Source
Posts: 24357
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Does PostProcess expect to autorun after rename ?

Post by rednoah »

:idea: Your code is wrong. It is running and failing for every single file:

Error: Select all

Cannot invoke method or() on null object
This particular error message is likely caused by this bit, where you invent new variables (which are null by default) and then use the | or operator on them, which conceptually doesn't make sense either, but machine does what code says, and this code could never not fail:

Groovy: Select all

lockedfields(SortParentIndexNumber|SortIndexNumber)



:arrow: You'll want to prototype your Custom Post-Processing Scripts in the GUI first, ideally after renaming a batch of sample files first so that FileBot can pick up your most recent rename batch as test data to work with:

ScreenshotScreenshot


:arrow: You can use the Generate custom NFO files to get started. Do a test run before make any changes. See how it works. Then make small changes step by step ensuring everything still works after each and every step. The code you posted looks like you just made up stuff.



:idea: If you're using AI tools, remember that those tools only work if the solution can be effectively be copy & pasted from GitHub merged from a thousand examples that more or less do what you're asking for. Generate custom NFO files is the only viable example in the training set for your use case, so the AI tools likley can't go much beyond just copy & pasting that and then hallucinating everything else you asked for from there.



EDIT
:arrow: Here's some code to get you started with custom Episode NFO files:

Groovy: Select all

{ source, target ->
	XML(target.dir / target.nameWithoutExtension + '.nfo') {
		nfo {
			plot(episode.info.overview)
			lockdata('false')
			lockedfields('SortParentIndexNumber|SortIndexNumber')
			title(t)
			tvdbid(episode.id)
			runtime(episode.runtime)
			aired(d)

			if (episode.special) {
				episode(episode.special)
				season(0)
				displayepisode(episode.info.raw.airsBeforeEpisode ?: episode.special)
				displayseason(episode.info.raw.airsBeforeSeason ?: 0)
			} else {
				episode(e)
				season(s)
				displayepisode(e)
				displayseason(s)
			}

			fileinfo {
				streamdetails {
					target.mediaInfo.Video.each{ v ->
						video {
							codec(v.'Encoded_Library/Name' ?: v.'CodecID/Hint' ?: v.'Format')
							aspect(v.'DisplayAspectRatio')
							width(v.'Width')
							height(v.'Height')
						}
					}
					target.mediaInfo.Audio.each{ a ->
						audio {
							codec(a.'CodecID/Hint' ?: a.'Format')
							language(a.'Language/String3')
							channels(a.'Channel(s)_Original' ?: a.'Channel(s)')
						}
					}
				}
			}
		}
	}
}
:idea: Please read the FAQ and How to Request Help.
n1n1
Posts: 7
Joined: 08 Jan 2026, 12:57

Re: Does PostProcess expect to autorun after rename ?

Post by n1n1 »

Thank you for fixing my code and adjusting it :)

One last request if I may.
My native language is french (nobody's perfect !)

When I reselect French in pref, did rename again, <plot> (ep overview) is displaying this :

Format: Select all

<nfo>
  <plot>第4話と第5話の間の、数か月間に起きた物語。
ヴァイオレットのもとに舞い込んだとある歌姫からの代筆依頼を描く、特別番外編を収録!</plot>
  <lockdata>false</lockdata>
  <lockedfields>SortParentIndexNumber|SortIndexNumber</lockedfields>
  <title>Le jour où tu comprendras « l'Amour » viendra sûrement</title>
  <tvdbid>6497072</tvdbid>
  <runtime>35</runtime>
  <aired>2018-07-04</aired>
  <episode>1</episode>
  <season>0</season>
  <displayepisode>5</displayepisode>
  <displayseason>1</displayseason>
User avatar
rednoah
The Source
Posts: 24357
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Does PostProcess expect to autorun after rename ?

Post by rednoah »

If the plot value is not available in your preferred language, then the plot value may be served in the original language.
:idea: Please read the FAQ and How to Request Help.
n1n1
Posts: 7
Joined: 08 Jan 2026, 12:57

Re: Does PostProcess expect to autorun after rename ?

Post by n1n1 »

ok got it
anyway after emby metadat refresh, plot is finely updated, also others missing data are added.

I'd like to warmly thank you again for your active and effective support
really appreciated

Kind regards,
User avatar
rednoah
The Source
Posts: 24357
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Does PostProcess expect to autorun after rename ?

Post by rednoah »

What is the script you ended up using in the end? Please copy & paste for the next guy.
:idea: Please read the FAQ and How to Request Help.
Post Reply