Watch folder Java error on Version 4.5

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

Watch folder Java error on Version 4.5

Post 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?
User avatar
rednoah
The Source
Posts: 19150
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Watch folder Java error on Version 4.5

Post by rednoah »

I think the method is called watchFolder now.

@see http://pastebin.com/6v4V5Bk7
:idea: Please read the FAQ and How to Request Help.
Amishman
Donor
Posts: 51
Joined: 29 Dec 2013, 15:54

Re: Watch folder Java error on Version 4.5

Post 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?
User avatar
rednoah
The Source
Posts: 19150
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Watch folder Java error on Version 4.5

Post by rednoah »

Something like this:

Code: Select all

f.watchFolder(false, false, 5000) { println it }
See net/filebot/cli/ScriptShellMethods.java for details.
:idea: Please read the FAQ and How to Request Help.
Post Reply