ExpressionFormat API Example

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

ExpressionFormat API Example

Post by rednoah »

Here's an example on how to use FileBots ExpressionFormat API.

Java:

Code: Select all

public static class Bindings {
	
	@Define("r")
	public int getRandom() {
		return Math.abs(new Random().nextInt());
	}
};


public static void main(String[] args) throws Exception {
	ExpressionFormat template = new ExpressionFormat("Random number = {r}");
	System.out.println(template.format(new Bindings()));
}
Output:

Code: Select all

Random number = 1232064860
PS: You're welcome to use FileBot as API. Most of the (non-GUI) code is written as API anyway. Make sure to give me some credits though. ;)
:idea: Please read the FAQ and How to Request Help.
Post Reply