Page 1 of 1

Taking Release group from {group}, if not, from filename

Posted: 15 Sep 2013, 20:59
by Mimo
Hi,
I am (re)posting this with help/advice from Rednoah, with some additional solution, for anyone interested:

I've looked into adding the Release groups to the (resulting) filenames but couldn't make it work.
It's really important to me to retain the information of origin (at-a-glance).

1. The {groups} binding is the best possible solution when it works, but one can still find many files where this is not the case.
2. For such instances regex text pattern matching in filename is a good enough solution.

This is what I have put together (using some of the naming schemes shared, the more complete expression shared by "Igor" does not work for me, I was not able to come up with a more robust one myself):

Code: Select all

{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])\w+$)|(?:^\w+(?=[-]))/)}; if(g==null && m!=null) return [m]; if(g!=null) return [g]}
I haven't thoroghly tested this but it at least looks to be working. (Likely there will be some problems with additional extensions to filenames.)

Thanks again and kudos, Rednoah!

Re: Taking Release group from {group}, if not, from filename

Posted: 22 Sep 2013, 07:27
by Mimo
Hi!

One "small" issue I can not get around, no matter what I try:

It turns out often files can have additional extension, like "movie.file.name-Group.ext1.ext2".
In such cases the regex which would otherwise work, does not.

The regex should actually match from end-of-string to "-"
or
from end-of-string to first "." to "-".

Is is possible to match such instances within a single regex?

I managed to put together two separate regexes, but combining them would not work.
Thanks for any advice!

Re: Taking Release group from {group}, if not, from filename

Posted: 22 Sep 2013, 08:46
by rednoah
e.g.

Code: Select all

[-]([^.]+)[.]

Code: Select all

{"movie.file.name-Group.ext1.ext2".match(/[-]([^.]+)[.]/)}

Re: Taking Release group from {group}, if not, from filename

Posted: 23 Jul 2014, 06:41
by hellraiser
Thank you for this. It helped me a lot!! :)

Re: Taking Release group from {group}, if not, from filename

Posted: 02 Aug 2014, 19:07
by arcelas
What do we do about it pulling words from the title to "create" a group?

for example: A Nightmare On Elm Street 3 - Dream Warriors (1987) (R) [1080p] [BluRay] [x264] [DTS] [5.1] [DREAM]

Now as I ripped this Bluray myself, I happen to know there was no "group". But I have to go back through and remove these erroneous groups by hand. Any ideas?

Re: Taking Release group from {group}, if not, from filename

Posted: 02 Aug 2014, 19:33
by rednoah
In your specific case this should do the trick:

Code: Select all

{n.findMatch(group) ? null : group}

Re: Taking Release group from {group}, if not, from filename

Posted: 11 Oct 2016, 05:06
by river
This is not working for me.
If I test individually {group} is null and {fn.match(/(?:(?<=[-])\w+$)|(?:^\w+(?=[-]))/)} is "HiSD" but above regex does not return anything.

Re: Taking Release group from {group}, if not, from filename

Posted: 11 Oct 2016, 05:35
by rednoah
{group} cannot be null because it'll throw a BindingException instead.

e.g. try to use group, otherwise match from filename via regex:

Code: Select all

any{group}{fn.match(/regex/)}

Re: Taking Release group from {group}, if not, from filename

Posted: 11 Oct 2016, 07:22
by river
Thank you it worked