primarytitle depending on folderpath

Any questions? Need some help?
Post Reply
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

primarytitle depending on folderpath

Post by Ztrust »

Thanks to the wonderfull new update :D I have managed to sort my danish movies to their own folder but now im left with a new problem ;) I would like to do it like this if folderpath = danish movies then primary title. Everthing else just name.
I have been over the forum but cant seem to find the right post
ofcourse this dosent work but it is as close as ive come and illustrates what I am trying to do

Code: Select all

{file.path =~ /danish movies/ ? '{primarytitle}' : '{n}'}

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

Re: primarytitle depending on folderpath

Post by rednoah »

Within a {...} expression, everything is code, so {} is not about variables, and {} within the code part is completely different from the outer most {...} defining where code starts and where code ends.

Code: Select all

{file.path =~ /Danish Movies/ ? primaryTitle : n}
:idea: Please read the FAQ and How to Request Help.
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

Re: primarytitle depending on folderpath

Post by Ztrust »

thank you my friend I was looking at a long night
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

Re: primarytitle depending on folderpath

Post by Ztrust »

hey Rednoah

I am posting here in the hope you will see it, so i dont have to start a new thread.
the format dosent seem to want to use the primaryTitle, would you mind telling me what is wrong
full format

Code: Select all

{info.ProductionCountries.contains('Denmark') ? 'Danish Movies' : genres.contains('Animation') ? 'Cartoons' : n.sortName() =~ /^(?i)[0-9]/ ? '0-9' : n.sortName() =~ /^(?i)[a-d]/ ? 'ABCD' : n.sortName() =~ /^(?i)[e-h]/ ? 'EFGH' : n.sortName() =~ /^(?i)[i-l]/ ? 'IJKL' : n.sortName() =~ /^(?i)[m-p]/ ? 'MNOP' : n.sortName() =~ /^(?i)[q-t]/ ? 'QRST' : n.sortName() =~ /^(?i)[u-å]/ ? 'UVWYXZ' : '~'}/{file.path =~ /Danish Movies/ ? primaryTitle : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)}
the part that is making trouble

Code: Select all

{file.path =~ /Danish Movies/ ? primaryTitle : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)}
found some more in my attempt to finsh my format, I have added the dc match since a group use dc instead of directors cut, I found out how to replace it but now it breaks DC showcase match, its a very small problem but I would still like some help to solve it.

Code: Select all

{'['+fn.replaceAll(/(?i)dc|director's/, 'Directors Cut').matchAll(/UNRATED|REMASTERED|EXTENDED|UNCUT|DIRECTORS.CUT|THEATRICAL.CUT/).join('][').upperInitial().lowerTrail()+']'}

how do i tell replaceall to ignore dc if it is the first ?

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

Re: primarytitle depending on folderpath

Post by rednoah »

1.
Have you confirmed that {primaryTitle} works as expected? It may be empty.

2.

Code: Select all

{'dc'.replaceAll(/(?i)(?<!^)dc|director's/, 'TEST')}
@see http://www.regular-expressions.info/lookaround.html
:idea: Please read the FAQ and How to Request Help.
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

Re: primarytitle depending on folderpath

Post by Ztrust »

hey
yeah primary title did work :D
but went back to the forum and looked through some of the crazy codes and adjusted and got it working

Code: Select all

{info.SpokenLanguages[0] ==~ /(no|da|sv|nb)/ ? 'Danish Movies' :genres.contains('Animation') ? 'Cartoons' : n.sortName() =~ /^(?i)[0-9]/ ? '0-9' : n.sortName() =~ /^(?i)[a-d]/ ? 'ABCD' : n.sortName() =~ /^(?i)[e-h]/ ? 'EFGH' : n.sortName() =~ /^(?i)[i-l]/ ? 'IJKL' : n.sortName() =~ /^(?i)[m-p]/ ? 'MNOP' : n.sortName() =~ /^(?i)[q-t]/ ? 'QRST' : n.sortName() =~ /^(?i)[u-å]/ ? 'UVWYXZ' : '~'}/{info.SpokenLanguages[0] ==~ /(sv|da|no)/  ? primaryTitle : n.replaceFirst(/^(?i)(The)\s(.+)/, /$2, $1/)}

This one works now for all ;)
Is it possible to get the danish collection name ?
and regarding the

Code: Select all

n.sortName() =~ /^(?i)[a-d]/ ? 'ABCD' 
could one exclude the A from the sort and still keep the
since movies like "a million ways to die in the west" and "a man apart" both ends up in M ?
It was a good link you sent me though I already had it open in my browser :shock:
I know it may not seem like it but i do try to figure it out before asking, but its all groovy to me
Anyways Thanks again for your help

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

Re: primarytitle depending on folderpath

Post by rednoah »

1.
Only if you set Preferred Language to Danish. But then you get Danish titles as well. So it's a no I guess.

2.
You can do your own replace logic for "The" => viewtopic.php?f=5&t=211
:idea: Please read the FAQ and How to Request Help.
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

Re: primarytitle depending on folderpath

Post by Ztrust »

hey
I have been there and tried that but then the dark knight goes to T folder ?
User avatar
rednoah
The Source
Posts: 22975
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: primarytitle depending on folderpath

Post by rednoah »

I can't be bothered to go through the details of your format. ;)

You can easily test things out step by step:

Code: Select all

{'the dark night'.replaceFirst(/^(?i)(The|A|An)\s(.+)/, /$2, $1/)[0]}
:idea: Please read the FAQ and How to Request Help.
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

Re: primarytitle depending on folderpath

Post by Ztrust »

what a difference a [0] makes
thanks for taking the time ;)
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

Re: primarytitle depending on folderpath

Post by Ztrust »

hey rednoah
I'm affraid im still stuck on the dc replace. the fix you posted and what I have done myself works on fn but not on file path

Code: Select all

{n} ({y}) {'['+file.path.replaceAll(/(?i)(?<!^).dc/, 'directors cut').matchAll(/UNRATED|REMASTERED|EXTENDED|UNCUT|DIRECTORS.CUT|THEATRICAL.CUT/).join('][').upperInitial().lowerTrail()+']'}
this gives me
a man apart [directors cut]
DC showcase catwoman [directors cut]
it takes the dc from catwoman and make it to Directors cut
will this not work on file.path ?

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

Re: primarytitle depending on folderpath

Post by rednoah »

Do you know the value of file.path? Let's try!

Code: Select all

{file.path}
Oh! It's the full path! So it starts with / and not D, I guess we have to check for /DC then.
:idea: Please read the FAQ and How to Request Help.
Ztrust
Posts: 69
Joined: 21 Dec 2013, 17:04

Re: primarytitle depending on folderpath

Post by Ztrust »

Again thank you ;)
I will play with this
and yes I did know the Value ;D
Post Reply