I was thinking of a csv file with a map of replacements, for example:
Code: Select all
[rarbg];
[ettv];ETTV
...
Code: Select all
import java.util.regex.Pattern
def map = csv('path/to/file.csv')
def s = String
map.each{ k, v ->
def p = Pattern.compile(Pattern.quote(k), Pattern.CASE_INSENSITIVE)
s = file.getPath().replaceAll(p, v)
}
return s
Code: Select all
Big.Hero.6.2014.1080p.BluRay.x264-SPARKS[rarbg]/ -> Big.Hero.6.2014.1080p.BluRay.x264-SPARKS/