exclude some files before processing

Running FileBot from the console, Groovy scripting, shell scripts, etc
Post Reply
stork
Posts: 4
Joined: 26 Jul 2013, 09:21

exclude some files before processing

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

Re: exclude some files before processing

Post 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.
:idea: Please read the FAQ and How to Request Help.
stork
Posts: 4
Joined: 26 Jul 2013, 09:21

Re: exclude some files before processing

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

Re: exclude some files before processing

Post 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']
:idea: Please read the FAQ and How to Request Help.
Post Reply