Watch Folder Script will not Run

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
Amishman
Donor
Posts: 56
Joined: 29 Dec 2013, 15:54

Watch Folder Script will not Run

Post by Amishman »

When I try to run my watch folder script I receive this error.
C:\Users\Amishman>filebot -script C:\Scripts\folder_watcher.groovy G:/Watched
MissingMethodException: No signature of method: java.util.ArrayList.watch() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@d3d0d4]
Possible solutions: with(groovy.lang.Closure), each(groovy.lang.Closure), wait(), tail(), wait(long), last()
groovy.lang.MissingMethodException: No signature of method: java.util.ArrayList.
watch() is applicable for argument types: (Script1$_run_closure1) values: [Script1$_run_closure1@d3d0d4]
Possible solutions: with(groovy.lang.Closure), each(groovy.lang.Closure), wait(), tail(), wait(long), last()
at Script1.run(Script1.groovy:1)
at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:60)
at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:81)
at net.filebot.cli.ArgumentProcessor.process(ArgumentProcessor.java:108)

at net.filebot.Main.main(Main.java:192)
Failure (░_░)
Launch4j: Failed to run the given command.
FileBot 4.1 (r2191) / Java(TM) SE Runtime Environment 1.7.0_55
This is my watch folder script.

Code: Select all

def watchman = args.watch { changes ->
_guarded {
execute('''filebot -script fn:amc -non-strict --output "G:/" "G:/Watched" --log-file amc.log --action move --conflict override --def \"seriesFormat=TV/{n}/{'Season '+s.pad (1)}/{s00e00} {t}\" \"movieFormat=New Movies/{n}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\\\"\\\"}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \\\" \\\") + ')'} ({y}) {[vf]}/{n}{fn.contains('3D') || fn.contains('3-D') ? ' '+'3D':\\\"\\\"}{' (' + fn.matchAll(/extended|uncensored|remastered|unrated|uncut|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, \\\" \\\") + ')'} ({y})\" \"musicFormat=H:/Music/{n}/{\$album/}{\${pi.pad(2)}. } {t}\" --def plex=localhost --def clean=y --def deleteAfterExtract=y''')
  }
}

watchman.commitDelay = 5 * 1000
watchman.commitPerFolder = false

println "Waiting for events"
if (console) { console.readLine() } else { sleep(Long.MAX_VALUE) } // keep running and watch for changes
Any idea why I am receiving this error? Do I need to use an older version of FileBot?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Watch Folder Script will not Run

Post by rednoah »

Things have changed.

Try these:

1.
replace args.watch with args[0].watch

2.
Don't use _guarded { } block
:idea: Please read the FAQ and How to Request Help.
Amishman
Donor
Posts: 56
Joined: 29 Dec 2013, 15:54

Re: Watch Folder Script will not Run

Post by Amishman »

Thanks, works great!
Post Reply