Page 1 of 1

exclude some files before processing

Posted: 26 Jul 2013, 09:37
by stork
hi,

I use this script: http://www.filebot.net/scripts/sorty.groovy and would like to exclude some files before

Code: Select all

	
// fetch subtitles
	files += getSubtitles(file:files)
Essentially moving them immediately with

Code: Select all

rename(file:files, db:'TVRage', format:episodeFormat, strict:false)
before subtiltes are fetched.

what would be the way to go here?

stork

Re: exclude some files before processing

Posted: 29 Jul 2013, 12:39
by rednoah
The variables files is a list of files that gets passed into each of those filebot functions. So just add some code for filtering the list you pass into any of those functions.

Re: exclude some files before processing

Posted: 30 Jul 2013, 14:01
by stork
Sure, but I'm a bit overwhelmed in regard to groovy. is "files" a predefined list or can I do something like

Code: Select all

	def subs = files{ 
	!(it =~ /(?i:Futurama.)/) \
	&& !(it =~ /(?i:Family Guy.)/) \
	}

	// fetch subtitles
	subs += getSubtitles(file:subs)

	
	rename(file:subs, db:'TVRage', format:episodeFormat, strict:false)
right now this throws some (for me) unintelligible errors..

Re: exclude some files before processing

Posted: 30 Jul 2013, 17:10
by rednoah
You'll need to check the code on where the input file list comes from.

Looking at your code I guess you get the basic idea but don't really get groovy collections:
http://groovy.codehaus.org/Collections

e.g.

Code: Select all

def words = ['ant', 'buffalo', 'cat', 'dinosaur']
assert words.findAll{ w -> w.size() > 4 } == ['buffalo', 'dinosaur']