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

All about user-defined episode / movie format expressions
Post Reply
Mimo
Posts: 12
Joined: 15 Sep 2013, 09:46

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

Post by Mimo » 15 Sep 2013, 20:59

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!

Mimo
Posts: 12
Joined: 15 Sep 2013, 09:46

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

Post by Mimo » 22 Sep 2013, 07:27

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!

User avatar
rednoah
The Source
Posts: 16810
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post by rednoah » 22 Sep 2013, 08:46

e.g.

Code: Select all

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

Code: Select all

{"movie.file.name-Group.ext1.ext2".match(/[-]([^.]+)[.]/)}
:idea: Please read the FAQ and How to Request Help.

hellraiser
Posts: 6
Joined: 19 May 2014, 04:30

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

Post by hellraiser » 23 Jul 2014, 06:41

Thank you for this. It helped me a lot!! :)

arcelas
Posts: 7
Joined: 19 Jul 2014, 03:04

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

Post by arcelas » 02 Aug 2014, 19:07

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?

User avatar
rednoah
The Source
Posts: 16810
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post by rednoah » 02 Aug 2014, 19:33

In your specific case this should do the trick:

Code: Select all

{n.findMatch(group) ? null : group}
:idea: Please read the FAQ and How to Request Help.

river
Posts: 17
Joined: 22 Sep 2016, 07:05

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

Post by river » 11 Oct 2016, 05:06

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.

User avatar
rednoah
The Source
Posts: 16810
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

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

Post by rednoah » 11 Oct 2016, 05:35

{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/)}
:idea: Please read the FAQ and How to Request Help.

river
Posts: 17
Joined: 22 Sep 2016, 07:05

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

Post by river » 11 Oct 2016, 07:22

Thank you it worked

Post Reply