Support for multiple subtitles in the same language

All your suggestions, requests and ideas for future development
Pat
Posts: 23
Joined: 07 Nov 2014, 15:52

Re: Support for multiple subtitles in the same language

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

Re: Support for multiple subtitles in the same language

Post 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}]/)}
:idea: Please read the FAQ and How to Request Help.
User avatar
rednoah
The Source
Posts: 23931
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Support for multiple subtitles in the same language

Post by rednoah »

FileBot r3768+ supports the {sub} binding which yields values like ".eng" or ".eng.forced"
:idea: Please read the FAQ and How to Request Help.
Post Reply