Page 1 of 1

Watch folder Java error on Version 4.5

Posted: 25 Sep 2014, 01:40
by Amishman
I updated my java to version 8 and copied the newest FileBot.jar.

FileBot 4.5 (r2578) / Java(TM) SE Runtime Environment 1.8.0_20

The GUI and uTorrent script work fine. When I try to run my watch folder script, I receive an error.

Image

I have my script in a batch file that is set to start whenever the computer is restarted. It works fine in Filebot 4.2.

Code: Select all

def watchman = args[0].watch { changes ->
execute('''filebot -script fn:amc -non-strict --output "E:/" "G:/Watched" --log-file amc.log --action move --conflict auto --def "seriesFormat={['E:', 'F:', 'G:', 'H:'].collect{ drive -> def a=n; return new File(drive+'/TV/', a)}.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{episode.special ? 'Season '+s.pad(2) : 'Season '+s.pad(1)}/{s00e00} {t}" \"movieFormat={['E:', 'F:', 'G:', 'H:'].collect{ new File(it+'/Movies/'+any{collection+'/'}{''}) }.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{n.replaceFirst(/^(?i)(The|A|An)\\s(.+)/, /$2, $1/)} {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=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
What does it not like?

Re: Watch folder Java error on Version 4.5

Posted: 25 Sep 2014, 04:10
by rednoah
I think the method is called watchFolder now.

@see http://pastebin.com/6v4V5Bk7

Re: Watch folder Java error on Version 4.5

Posted: 26 Sep 2014, 00:47
by Amishman
When I run it, everything appears to work. There are no errors but nothing happens.

Code: Select all

def output = 'E:/'
def input = 'G:/Watched'
 
(input as File).watchFolder { files ->
        executeScript('dev:amc', ['--action', 'move', '-non-strict', '--output', output, '--log-file', 'amc.log', '--conflict', 'auto'], [minFileSize:0], '''--def "seriesFormat={['E:', 'F:', 'G:', 'H:'].collect{ drive -> def a=n; return new File(drive+'/TV/', a)}.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{episode.special ? 'Season '+s.pad(2) : 'Season '+s.pad(1)}/{s00e00} {t}" \"movieFormat={['E:', 'F:', 'G:', 'H:'].collect{ new File(it+'/Movies/'+any{collection+'/'}{''}) }.sort{ a,b -> a.exists() <=> b.exists() ?: a.diskSpace <=> b.diskSpace }.last()}/{n.replaceFirst(/^(?i)(The|A|An)\\s(.+)/, /$2, $1/)} {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=Music/{n}/{\$album/}{\${pi.pad(2)}. } {t}\" --def plex=localhost --def clean=y --def deleteAfterExtract=y --def deleteAfterExtract=y --def clean=y --def plex=localhost''')
}

println "Waiting for events"
sleep Integer.MAX_VALUE
This is the result:
Image

What am I doing wrong?

How long is the default time for it to check if something has been added to the watch folder? Is there away to adjust the time to 5 or 10 seconds?

Re: Watch folder Java error on Version 4.5

Posted: 26 Sep 2014, 06:57
by rednoah
Something like this:

Code: Select all

f.watchFolder(false, false, 5000) { println it }
See net/filebot/cli/ScriptShellMethods.java for details.