Page 1 of 1
file,path replace
Posted: 25 Nov 2014, 08:33
by Ztrust
hey rednoah
I am still strugling with this
http://www.filebot.net/forums/viewtopic ... 063#p11942
Code: Select all
{n} ({y}) {'['+file.path.replaceAll(/(?i)(?<!^).dc/, 'directors cut').matchAll(/UNRATED|REMASTERED|EXTENDED|UNCUT|DIRECTORS.CUT|THEATRICAL.CUT/).join('][').upperInitial().lowerTrail()+']'}
rednoah wrote:Do you know the value of
file.path? Let's try!
Oh! It's the full path! So it starts with
/ and not
D, I guess we have to check for
/DC then.
I cant figure out how to get the /DC in without bracking the format ?
ztrust
Re: file,path replace
Posted: 25 Nov 2014, 09:00
by rednoah
What do you have?
What do you want?
With examples please.
Re: file,path replace
Posted: 25 Nov 2014, 10:59
by Ztrust
Hi
let me explain
I have this format with file.path replace because I noticed I missed alot of directors cut tag because it was listed as DC in the file name and not folder name
full format
Code: Select all
D:/Movies/{genres.contains('Animation') ? 'Cartoons' : info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? 'Nordic Movies' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[0-9]/ ? '0-9' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[a-d]/ ? 'ABCD' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[e-h]/ ? 'EFGH' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[i-l]/ ? 'IJKL' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[m-p]/ ? 'MNOP' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[q-t]/ ? 'QRST' : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)[0] =~ /^(?i)[u-å]/ ? 'UVWYXZ' : '~'}/{collection.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!").replaceAll(/(?i)Collection/).trim()+' (Collection)/'}{info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? primaryTitle.upperInitial().replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!") : n.replaceFirst(/^(?i)(The)\s(.+)/,/$2, $1/).replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!")} ({y}){' ['+file.path.replaceAll(/(?i)theatrical/, '$0 Cut').replaceAll(/(?i)director's.cut|.dc/, 'Directors cut').matchAll(/extended|uncensored|remastered|ultimate.cut|unrated|uncut|Theatrical.Cut|imax|final.cut|Theatrical.edition|3d|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().unique().join('] [').replaceAll(/[._´]/," ") + ']'}/{info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? primaryTitle.upperInitial().replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!") : n.replaceAll(/[:|]/, ".").replaceAll(/[?]/, "!")} ({y}){' ['+file.path.replaceAll(/(?i)theatrical/, '$0 Cut').replaceAll(/(?i)director's.cut|.dc/, 'Directors cut').matchAll(/extended|uncensored|remastered|ultimate.cut|unrated|uncut|Theatrical.Cut|imax|final.cut|Theatrical.edition|3d|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().unique().join('] [').replaceAll(/[._´]/," ") + ']'}{' '+[c{source} ?: 'BDrip']}{"."+lang}
Replace part
Code: Select all
{' ['+file.path.replaceAll(/(?i)theatrical/, '$0 Cut').replaceAll(/(?i)director's.cut|.dc/, 'Directors cut').matchAll(/extended|uncensored|remastered|ultimate.cut|unrated|uncut|Theatrical.Cut|imax|final.cut|Theatrical.edition|3d|directors.cut|special.edition/)*.upperInitial()*.lowerTrail().sort().unique().join('] [').replaceAll(/[._´]/," ") + ']'}
and it works for the most part exept that it adds Directors Cut to DC Showcase. Like so DC showcase Catwoman Directors Cut
Re: file,path replace
Posted: 25 Nov 2014, 13:15
by rednoah
I'd solve the problem with Lookahead and Lookbehind:
http://www.regular-expressions.info/lookaround.html
e.g.
Code: Select all
{'DC Foobar DC'.replaceAll(/(?<=\W)DC(?!\w)/, 'Directors Cut')}