I would like to create a groovy script to perform on files, rather than folders as show in 'sorty.groovy'
1. Fetch Artwork & NFO
2. Rename and Move to Destination
Would combining artwork.tmdb.groovy script be advisable?
I'm working on one portion of the code at a time, yes, it's missing code for Artwork & NFO.
Code: Select all
def movieDir = '''M:/Movies'''
def movieFormat = '''//NAS/Movies/{n} ({y})/{n} ({y}){"CD$pi"}'''
def movieOutput = '''//NAS/Movies/'''
movieDir.getFiles{ !it.isVideo() }.each{ file ->
println "Processing: $file"
def files = file.listFiles{ it.isVideo() }
rename(file:files, db:'TheMovieDB', format:movieFormat, output:movieOutput)
}
Code: Select all
C:\Program Files\FileBot>filebot -script test2.groovy
MissingMethodException: No signature of method: java.lang.String.getFiles() is a
pplicable for argument types: (Script1$_run_closure1) values: [Script1$_run_clos
ure1@498d318c]
Possible solutions: getBytes(), getBytes(java.lang.String), getBytes(java.nio.ch
arset.Charset), getClass(), toFile(), getChars()
groovy.lang.MissingMethodException: No signature of method: java.lang.String.get
Files() is applicable for argument types: (Script1$_run_closure1) values: [Scrip
t1$_run_closure1@498d318c]
Possible solutions: getBytes(), getBytes(java.lang.String), getBytes(java.nio.ch
arset.Charset), getClass(), toFile(), getChars()
at Script1.run(Script1.groovy:6)
at net.filebot.cli.ScriptShell.evaluate(ScriptShell.java:61)
at net.filebot.cli.ScriptShell.runScript(ScriptShell.java:82)
at net.filebot.cli.ArgumentProcessor.process(ArgumentProcessor.java:112)
at net.filebot.Main.main(Main.java:169)
Failure (°_°)
This does work for the basic rename/move. However, I would like for the .groovy script to handle all arguments (input/output) rather than having to specify it in the CLI.
Code: Select all
def movieDir = '''M:/Movies'''
def movieFormat = '''{n} ({y})/{n} ({y}){"CD$pi"}'''
def movieOutput = '''//NAS/Movies/'''
args.getFiles{ it.isVideo() }.each{
println "Processing: $it"
rename(file:it, db:'TheMovieDB', format:movieFormat, output:movieOutput)
}