Page 1 of 1

Special handling for Movie Collection folders

Posted: 16 Dec 2018, 16:52
by cyberdoggy
I have altered my scheme many times and it is almost where I want it, but now that I can number my collections movie names I need to alter my code so that if the movie is part of a collection it does not create a subfolder for it, and the movies in the collections will all be in one dir as opposed to separate ones. I will try to give an example here...
right now my code is

Code: Select all

H:/{fn=~/2160p/?'Movies 4K':'Movies'} {vc =~ /HEVC|265/ ? '(x265)' : '(x264)'}/{norm = {it.colon(' - ').tr('*?|', ' !-').asciiQuotes().replaceAll(/\b(?i)[IVX]+\b/, { it.upper() }).replaceAll(/\b[0-9](?i:|st|nd|rd|th)\b/, { it.lower() }).replaceAll(/(Collection) of the (.+)/, /$2 $1/).replaceAll(/(Saga) Collection/, /$1/).replaceAll(/^(i:|A|An|The) (.+)/, /$2, $1/)};path = allOf{ norm(collection) } { norm(n) }.join('/');path[0].replaceAll(/\W|\d/, '#') + '/' + path} {norm(n) != norm(primaryTitle) ? ' (' + primaryTitle + ')' : null}{fn =~ /3D|3-D/ ? ' 3D' : null} ({y}) {["$group"]}/ {model.findAll{ it.collection == collection }.sort{ it.d }.findIndexOf{ == id } + 1} {allOf{n.asciiQuotes().removeAll(/[,!]/)}{fn =~ /3D|3-D/ ? '3D' : null}{tags*.upper()}{' [' + fn.matchAll (/Expanded|Theatrical.Cut|4K.REMASTER|Colorized|PROPER|REPACK/)*.upperInitial()*.lowerTrail().sort().join(', ').replaceAll(/[._]/, " ") + ']'}{".$y"}{'Part'+pi}{".$vf"}{".$source"}{".$vc"}{if (bitdepth >= 10) '10bit'} {if (bitdepth >= 10)'HDR'}{".$ac"}{".$channels"}.join('.').space('.')}CH{'-'+group}
my collections look like this:
H:\Movies (x265)\A\Avengers Collection, The\1\Avengers, The (2012)\The.Avengers.2012.1080p.10bit.HDR.BluRay.AAC.7.1CH.x265.mkv
H:\Movies (x265)\A\Avengers Collection, The\2\Avengers - Age of Ultron (2015)\Avengers.Age.of.Ultron.2015.1080p.10bit.HDR.BluRay.AAC.7.1CH.x265.mkv
H:\Movies (x265)\A\Avengers Collection, The\3\Avengers - Infinity War (2018)\Avengers.Infinity.War.2018.1080p.10bit.HDR.BluRay.AAC.7.1CH.x265.mkv

I would like the collection to look like this:
H:\Movies (x265)\A\Avengers Collection, The\1 The.Avengers.2012.1080p.10bit.HDR.BluRay.AAC.7.1CH.x265.mkv
H:\Movies (x265)\A\Avengers Collection, The\2 Avengers.Age.of.Ultron.2015.1080p.10bit.HDR.BluRay.AAC.7.1CH.x265.mkv
H:\Movies (x265)\A\Avengers Collection, The\3 Avengers.Infinity.War.2018.1080p.10bit.HDR.BluRay.AAC.7.1CH.x265.mkv

Except when a movie does not have a collection I would like it to have the subfolder like this:
H:\Movies (x265)\A\Animal House (1978)\Animal.House.1978.1080p.AAC.5.1CH.x265.mkv

Re: Help with my scheme

Posted: 16 Dec 2018, 17:05
by rednoah
Sounds familiar. Is this a duplicate post?

rednoah wrote:
07 Dec 2018, 08:34
I'll focus on the key component only here:

Code: Select all

{any{collection + '/' + ci + '. '}{ny + '/'}}
This part will yield "Avatar Collection/1. " or "Avatar (2009)/" depending on whether or not {collection} and {ci} are defined.
:arrow: viewtopic.php?f=5&t=9552

:idea: Your format is quite complex. If you have trouble integrating example snippets, then it's best to split the format into the different separate components, and then only work on the one that is effected by the changes you wanna make, so we can focus on that specifically.

Re: Special handling for Movie Collection folders

Posted: 16 Dec 2018, 17:25
by cyberdoggy
Oh yes, sorry for the duplicate post as I am totally confused about this.

Re: Special handling for Movie Collection folders

Posted: 17 Dec 2018, 06:46
by rednoah
You just need to get rid of everything in your format that is not relevant to the problem at hand, then things will become obvious and easy.

e.g. What does this do? It gives us the "Movies (x265)" part, but that's completely independent of what might come before or after, and not relevant to this particular thread:

Code: Select all

{fn=~/2160p/?'Movies 4K':'Movies'} {vc =~ /HEVC|265/ ? '(x265)' : '(x264)'}

This is the part you want to build into your format:

Code: Select all

{any{collection + '/' + ci + '. '}{ny + '/'}}

Where exactly will become obvious once you remove everything that isn't relevant to this section of the filename.

A simple complete example might look like this:

Code: Select all

H:/Movies/{any{collection + '/' + ci + '. '}{ny + '/'}}{}
:arrow: {} is the usual filename part, preceded by "Avatar Collection/1. <name>" or "Avatar (2009)/<name>" depending on the situation.

Re: Special handling for Movie Collection folders

Posted: 18 Dec 2018, 00:42
by cyberdoggy
Thanks, I shall play with it some more!