Page 1 of 1

Input path Variable?

Posted: 11 Jul 2015, 14:54
by kithros
Looking for a little guidance,

I am trying to pass the input variable to a bash script,

Code: Select all

filebot -script /root/housekeeping.groovy  -extract -non-strict -r --conflict=override -rename /mnt/pool/incoming/completed/anime --output /mnt/pool/
Im looking to pass the /mnt/pool/incoming/completed/anime to the bash script:

Code: Select all

def sout = new StringBuffer(), serr = new StringBuffer()
def proc = '/scripts/filebotclean.sh <PATHVARIABLEHERE>'.execute()
proc.consumeProcessOutput(sout, serr)
proc.waitForOrKill(5000)
println "out> $sout err> $serr"
Any assistance in pointing me in the right direction would be great, I've looked thru some of the other rednoah scripts/ and forum and haven't found a solution that works for me.

Thanks

Re: Input path Variable?

Posted: 11 Jul 2015, 21:47
by rednoah
So this is really a shell script question? How to pass variables into a shell script? Well, I recommend having a look at the filebot startup script and see how it's done. Hint: "$@"

Re: Input path Variable?

Posted: 12 Jul 2015, 02:32
by kithros
Im sorry, I must not have been specific enough. The bash script works. I just dont know enough bout groovy to figure out what variable or method to call to get the input path that is given to filebot from the command line.

In my example I want to pass the /mnt/pool/incoming/completed/anime to my bash script ( that is ready to handle the input)

I can hard code the path (and it works) but i was trying to make it more modular, and allow me to use the same groovy script in a couple of different setups.

In your code, i some times see it used as $dir or it.name. But i have been unable to get those to work, and i suspect its my lack of groovy that is getting in the way. I am proficient in PHP, Java not so much :(

I hope that explains my issue better, I assume its something really simple i am just not wrapping my head around.

Thanks

Re: Input path Variable?

Posted: 12 Jul 2015, 06:33
by rednoah
FileBot call:

Code: Select all

filebot -script test.groovy /path/to/file --def "name=value"
Groovy:

Code: Select all

println args
println name