Page 1 of 1

eachMediaFolder retrieves only one folder

Posted: 25 Jun 2012, 00:00
by lboregard
rednoah, i have a simple script that does "args.eachMediaFolder { dir -> println "Listing $dir" } ... but it only lists the first folder ???

i'm running the portable version doing ./filebot.sh -script "scrape.groovy" -trust-script "/Volumes/Storage/Output"

any ideas what could be the problem ?

Re: eachMediaFolder retrieves only one folder

Posted: 25 Jun 2012, 00:20
by lboregard
well, now i know why ... after browsing over filebot's source code, i found that eachMediaFolder only returns folders that have files of "video" type.

How can i customize the list of video types ?

Re: eachMediaFolder retrieves only one folder

Posted: 25 Jun 2012, 01:38
by rednoah
What video filetypes are still missing? It's media.types in the jar. You can just do getFolders().findAll{...} and do what you wanna do.

e.g.

Code: Select all

args.getFolders{ it.hasFile{ it.hasExtension('avi', 'mkv') } }.each { dir ->
	println dir
}
or like this?

Code: Select all

def selection = args.getFiles{ it.hasExtension('avi', 'mkv') }

selection.mapByFolder().each { dir, fs ->
	println "$dir: $fs"
}