[DOCS] FileBot Groovy Expression Reference Documentation

All about user-defined episode / movie / file name format expressions
User avatar
The Source
Posts: 22849
Joined: 16 Nov 2011, 08:59
Location: Taipei

[DOCS] FileBot Groovy Expression Reference Documentation

Post by rednoah »

FileBot uses the Groovy language for format expressions, filter expressions and execute expressions:

The most important top-level bindings are documented here:

In addition to that, the entire FileBot / Groovy / Java API is at your disposal:
:!: The complete reference documentation for FileBot / Java / Groovy is so mind-bogglingly vast that it's likely going to be completely useless for your specific relatively simple coding needs.

:!: You will need Java / Groovy coding experience to navigate this vast amount of reference documentation.

e.g. Why does this work?

Format: Select all

{ f.name.match(/[regex]+/) }
  1. The outermost {...} delimit Groovy code.
  2. f is a top-level binding defined by FileBot, which returns a File object.
  3. File.getName() is called via the Groovy Getter Syntax and returns a String object.
  4. String.match(String regex) is a Groovy Extension Method for the String class specific to FileBot.
  5. /[regex]+/ is a Regular Expression pattern

:!: DON'T PANIC! You are standing on the shoulders of giants. You can read / write / modify custom formats to your liking and generally make sense of your typical FileBot format / filter / exec expression without any understanding of how any of it works under the hood. Although the complete reference documentation is vast, you'll need to understand little to none of it for your typical custom format expression or match filter expression or file filter expression or exec expression.
:idea: Please read the FAQ and How to Request Help.