Page 2 of 2

Re: Support for multiple subtitles in the same language

Posted: 19 Nov 2014, 00:01
by Pat
Your suggested

x.after[lang.ISO3, lang.ISO2, lang.name, lang].join('|')

to find the text after *or before) the matched language string does not work reliably.

If LANG matched and "English" in English-SHD, the above code will not find SHD but "lish.SHD"

I may find a solution where English, Eng and En all start identically, but there are casaes like
French where the string could be Fre or fra, and other unforseen problems.

The only clean solution is if filebot provides the matched string, ie: lang.matched.
I will not die without it, but it will be nice to have :)

Additionally, one needs to be careful with the use of \w as in some code provided on this page post
(in case some one wants to use it) It does not match only alphanumericals but also the "_" and fail whenever _ is used as separator.

Have not tested if groovy supports :alnum: instead, but replaced it with [a-zA-Z0-9] which gave me certainty.

Re: Support for multiple subtitles in the same language

Posted: 19 Nov 2014, 07:09
by rednoah
1.
You can use Posix groups like :alnum: but the syntax is a bit different:
https://docs.oracle.com/javase/8/docs/a ... ttern.html

2.
The word-boundary matcher should help, not sure about _ behaviour though. _ is probably considered a word character so it won't work as expected.

e.g.

Code: Select all

{'English'.after(/\b(/ + ['eng', 'en'].join('|') + /)\b/)}
Same with :alnum: instead of \b

Code: Select all

{'English.eng.test'.after(/[^\p{Alnum}](eng|en)[^\p{Alnum}]/)}

Re: Support for multiple subtitles in the same language

Posted: 24 Mar 2016, 11:15
by rednoah
FileBot r3768+ supports the {sub} binding which yields values like ".eng" or ".eng.forced"