Page 1 of 1

[DOCS] Holistic formats with the {model} binding

Posted: 22 Feb 2019, 06:18
by rednoah
{model} gives you access to all matches and bindings for each match for the current batch. Any binding that is available for a single match (e.g. n) can also be accessed for all matches (e.g. model.n).

:idea: If you have 3 matches / files, and use {episode} to format them, then you get a different name for each file because {episode} is different for each match. {model.episode} gives you all episode values for all matches for each match.

:idea: {model} is particularly useful when the destination path for a match doesn't just depend on the match itself, but on other matches processed in the same context as well.





Season 1-9 group folders:

Format: Select all

{ n } [Season { model.s.bounds().join('-') }]/{ plex.name }

Mark series folder complete if all known episodes of a given show are being processed in the current batch:

Format: Select all

{ n } { model.episode.containsAll(episodelist.episode) ? '[complete]' : '[incomplete]' }/{ plex.name }

Mark season folder complete if all known episodes of a given season are being processed in the current batch:

Format: Select all

{ n }/Season { s00 }{ model.episode.containsAll(episodelist.findAll{ it.e && it.s == s }.episode) ? ' [complete]' : ' [incomplete]' }/{ plex.name }

Bindings such as {vc} yield different values for different files. If we want {vc} tags in the folder name, but ensure that all files regardless of {vc} end up in the same folder, then we can use {model} to include all the different {vc} values in the folder path:

Format: Select all

{ n } { model.vc.sort().unique() }/{ plex.name }

Before the {ci} collection index binding was introduced, one could have used {model} to count all the {collection} values of the current match group and conjure up that particular value:

Format: Select all

{ model.findAll{ it.collection == collection }.sort{ it.d }.findIndexOf{ it.id == id } + 1 }