[HIRE REQUEST] Modified AMC script

Running FileBot from the console, Groovy scripting, shell scripts, etc
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [HIRE REQUEST] Modified AMC script

Post by rednoah »

Just copy what I'm doing. Something like:

Code: Select all

def message = output.getNameWithoutExtension().unique().sort{ it.toLowerCase() }.join('\n')
println message
:idea: Please read the FAQ and How to Request Help.
Tweak_four17
Donor
Posts: 53
Joined: 24 Apr 2014, 19:30

Re: [HIRE REQUEST] Modified AMC script

Post by Tweak_four17 »

Code: Select all

MissingPropertyException: No such property: output for class: Script3
groovy.lang.MissingPropertyException: No such property: output for class: Script3
	at Script3.run(Script3.groovy:324)
	at net.sourceforge.filebot.cli.ScriptShell.evaluate(ScriptShell.java:91)
	at net.sourceforge.filebot.cli.ScriptShell.runScript(ScriptShell.java:85)
	at net.sourceforge.filebot.cli.ArgumentProcessor.process(ArgumentProcessor.java:123)
	at net.sourceforge.filebot.Main.main(Main.java:192)
Failure (°_°)
and then

Code: Select all

def message = {output.getNameWithoutExtension().unique().sort{ it.toLowerCase() }.join('\n')}
outputs

Code: Select all

Script3$_run_closure61@50f3a0e8
I've got nothing.
User avatar
rednoah
The Source
Posts: 23940
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: [HIRE REQUEST] Modified AMC script

Post by rednoah »

The output variable doesn't magically just exist...

Code: Select all

def output = getRenameLog().values().toList()
def message = output.getNameWithoutExtension().unique().sort{ it.toLowerCase() }.join('\n')
println message
Also { ... } means it's a closure, not a value. So if you want the value that a closure evaluates to you need to call it.

e.g.

Code: Select all

def two = { 1 + 1 }
println two
println two()
You can try some tutorials on the Groovy, so that should help on understanding how it works a lot.
:idea: Please read the FAQ and How to Request Help.
Tweak_four17
Donor
Posts: 53
Joined: 24 Apr 2014, 19:30

Re: [HIRE REQUEST] Modified AMC script

Post by Tweak_four17 »

Well after many many different combinations and lots of googling I think I got it

Code: Select all

def output = getRenameLog().values().toList()
def getNotificationMessage = {output.collect{ it as File }*.getNameWithoutExtension().unique().sort{ it.toLowerCase() }.collect{ "• $it" }.join('\n')}
And it appears to be sending me just the output file name to my pushover. Yikes that was tough. Thanks for your help rednoah!
Post Reply