The below:
Code: Select all
{ specials = { allOf
{ tags.removeIf { it ==~ /(?i:imax)/ } }
{ def last = n.tokenize(" ").last()
fn.after(/(?i:$last)/).findAll(/(?i:imax).(?i:edition|version)?/)*.replaceAll(/[._-]/, " ") }
.flatten().sort() }
specials() }
returns
[IMAX Edition, true] in the format. So I'm guessing the function works as expected (returning a boolean).
Example filename >> Aquaman.2018.IMAX.Edition.1080p.BluRay.DDP7.1.x264-Geek.mkv
I believe something is happening because
tags is a binding, I tried the following, which works:
Code: Select all
{ def t = tags
t.add(3)
assert t == ['Imax', 3]
t.removeIf { it ==~ /(?i:imax)/ }
assert t == [3]
t.removeIf { it instanceof Integer }
assert t.size() == 0
specials = { allOf
{ t }
{ def last = n.tokenize(" ").last()
fn.after(/(?i:$last)/).findAll(/(?i:imax).(?i:edition|version)?/)*.replaceAll(/[._-]/, " ") }
.flatten().sort() }
specials() }
So I guess problem solved.
For reference, I also tried with groovysh on my machine:
Code: Select all
Groovy Shell (2.5.6, JVM: 11.0.2)
Type ':help' or ':h' for help.
groovy:000> tags = ['Imax']
===> [Imax]
groovy:000> out = tags.findAll { ! (it ==~ /(?i:imax)/) }
===> []
groovy:000> tags.removeIf { it ==~ /(?i:imax)/ }
===> true
groovy:000> assert out.size() == 0
===> null
groovy:000> assert tags.size() == 0
===> null
I only work in black and sometimes very, very dark grey. (Batman)