Problem with group detection

All about user-defined episode / movie / file name format expressions
Post Reply
dauntless101
Posts: 15
Joined: 07 Jan 2016, 19:39

Problem with group detection

Post by dauntless101 »

For some reason my renaming script has had an issue with group detection lately. This is what I am using:

Code: Select all

"seriesFormat=tv/{n}/{episode.special ? 'Special' : 'Season '+s.pad(2)}/{norm={it.upperInitial().lowerTrail().replaceTrailingBrackets().replaceAll(/\u0022/, '\'').replaceAll(/[:|]/, '.').replaceAll(/\?/, '!').replaceAll(/[*\s\.]+/, '.').replaceAll(/\b[IiVvXx]+\b/, { it.upper() }).replaceAll(/[0-9](th|nd|rd)/, { it.lower() })};norm(n) }.{episode.special ? 'S00E'+special.pad(2) : s00e00}.{norm(t)}{'.'+vf}{'.'+source}{'.'+fn.matchAll(/PROPER|REPACK/)*.upper().sort().join('.')}{'.'+vc.replace('Microsoft', 'VC-1').replace('AVC', 'x264')}{'.'+ac.replace('MPEG Audio', 'MP3')}{audio.FormatProfile =~ /MA Core/ ? '-HD.MA' : ''}{audio.FormatProfile =~ /ES/ ? '-ES' : ''}{audio.FormatProfile =~ /Pro/ ? '-Pro' : ''}{'.'+af.replace('8 6ch', '7.1').replace('7 6ch', '6.1').replace('6ch', '5.1').replace('3ch', '2.1').replace('2ch','2.0').replace('1ch','1.0')}{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g!=null) return '-'+g;}{'.'+lang}"
Specificallly the part about the groups here:

Code: Select all

{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g!=null) return '-'+g;}
Even when I tried just a standard {g} in the code it wasn't pulling groups. Not sure what changed because this used to work perfectly.

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

Re: Problem with group detection

Post by rednoah »

Please provide a simple reproducible test case (i.e. a filename where {group} doesn't work as expected).
:idea: Please read the FAQ and How to Request Help.
dauntless101
Posts: 15
Joined: 07 Jan 2016, 19:39

Re: Problem with group detection

Post by dauntless101 »

Code: Select all

[MOVE] Rename [/home/zachary/downloads/complete/movies/Miles.Ahead.2015.1080p.BluRay.DTS-HD.MA.5.1.x264-BluntSlayer-Obfuscated/edefc6a1d4a84fadbe14507b988ea317.mkv] to [/home/zachary/mounts/sorted/media/movies/Miles Ahead (2016)/Miles.Ahead.(2016).1080p.BluRay.x264.DTS.5.1.mkv]
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Problem with group detection

Post by rednoah »

Missing group names can be added upon request.

Please post missing group names here: viewtopic.php?f=5&t=4
:idea: Please read the FAQ and How to Request Help.
dauntless101
Posts: 15
Joined: 07 Jan 2016, 19:39

Re: Problem with group detection

Post by dauntless101 »

rednoah wrote:Missing group names can be added upon request.

Please post missing group names here: viewtopic.php?f=5&t=4
This is affecting all groups though, not just BluntSlayer. Check these examples:

[MOVE] Rename [/home/zachary/downloads/complete/movies/Star.Trek.3.Beyond.2016.1080p.BluRay.DTS.x264-CyTSuNee/Star.Trek.3.Beyond.2016.1080p.BluRay.DTS.x264-CyTSuNee.mkv] to [/home/zachary/mounts/sorted/media/movies/Star Trek Beyond (2016)/Star.Trek.Beyond.(2016).1080p.BluRay.x264.DTS.5.1.mkv]


[MOVE] Rename [/home/zachary/downloads/complete/movies/Sausage.Party.2016.BluRay.1080p.DTS-HD.MA.5.1.x264.dxva-FraMeSToR/Sausage.Party.2016.BluRay.1080p.DTS-HD.MA.5.1.x264.dxva-FraMeSToR.mkv] to [/home/zachary/mounts/sorted/media/movies/Sausage Party (2016)/Sausage.Party.(2016).1080p.BluRay.x264.DTS.5.1.mkv]

Furthermore, my code originally would parse out the group name from the filename if the AMC group detection did not grab anything. Been using this same script for over a year now, no idea why it stopped working.

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

Re: Problem with group detection

Post by rednoah »

You'll have to break apart your code and test all bits and pieces individually until you find the single smallest part that doesn't work as expected.

I'd start with {group} and the fn.match pattern.
:idea: Please read the FAQ and How to Request Help.
dauntless101
Posts: 15
Joined: 07 Jan 2016, 19:39

Re: Problem with group detection

Post by dauntless101 »

rednoah wrote:You'll have to break apart your code and test all bits and pieces individually until you find the single smallest part that doesn't work as expected.

I'd start with {group} and the fn.match pattern.
I understand that and I have been trying for over a week to figure this out. {group} works just fine but this snippet of code completely stopped working during the past month:

Code: Select all

{def g = c{group}; def m = c{fn.match(/(?:(?<=[-])[a-z0-9]+$)|(?:^[a-z0-9]+(?=[-]))/)}; if(g!=null) return '-'+g;}
I found this snippet posted elsewhere on the site so I can't be the only one. It worked for well over a year.
immenz
Posts: 8
Joined: 25 Oct 2016, 13:59

Re: Problem with group detection

Post by immenz »

Sorry for offtopic, but can anyone explain what c{...} does? I read it elsewhere but without explanation, and searching after a single letter is quite impossible...
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Problem with group detection

Post by rednoah »

This expression is not readable nor well-written. You shouldn't try to learn from it.

PS: the c(Closure) function doesn't exist in newer versions of FileBot
:idea: Please read the FAQ and How to Request Help.
dauntless101
Posts: 15
Joined: 07 Jan 2016, 19:39

Re: Problem with group detection

Post by dauntless101 »

rednoah wrote: PS: the c(Closure) function doesn't exist in newer versions of FileBot
Ah--that explains it then.
Post Reply