Special handling for Movie Collection folders

All about user-defined episode / movie / file name format expressions
Post Reply
cyberdoggy
Posts: 34
Joined: 03 Sep 2016, 21:27

Special handling for Movie Collection folders

Post 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{ it.id == 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
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Help with my scheme

Post 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.
:idea: Please read the FAQ and How to Request Help.
cyberdoggy
Posts: 34
Joined: 03 Sep 2016, 21:27

Re: Special handling for Movie Collection folders

Post by cyberdoggy »

Oh yes, sorry for the duplicate post as I am totally confused about this.
User avatar
rednoah
The Source
Posts: 22899
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Special handling for Movie Collection folders

Post 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 + '/'}}{plex.name}
:arrow: {plex.name} is the usual filename part, preceded by "Avatar Collection/1. <name>" or "Avatar (2009)/<name>" depending on the situation.
:idea: Please read the FAQ and How to Request Help.
cyberdoggy
Posts: 34
Joined: 03 Sep 2016, 21:27

Re: Special handling for Movie Collection folders

Post by cyberdoggy »

Thanks, I shall play with it some more!
Post Reply