Reference for model binding

All about user-defined episode / movie format expressions
Post Reply
devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Reference for model binding

Post by devster » 19 Feb 2018, 08:37

Hi, is there any thread/issue/documentation where it's explained what the {model} binding does and maybe some usage examples?
I've recently seen and looked for some topics on this but I couldn't find a comprehensive explanation.
Thanks
I only work in black and sometimes very, very dark grey. (Batman)

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

Re: Reference for model binding

Post by rednoah » 19 Feb 2018, 16:56

{model} gives you access to all matches of the current batch.

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.

Any binding that is available for a single match (e.g. n) can also be accessed for all matches (e.g. model.n).

It's thus extremely powerful and versatile but I don't have a specific use case for you, though it enables otherwise impossible ones.

e.g. {model} is useful when the destination path for a match doesn't just depend on the match itself, but all to other matches processed in the same context:

Code: Select all

$ filebot -rename *.mp4 -non-strict --format "{n}/Season {model.s.unique().join('-')}/{episode}"
[MOVE] from [Alias.1x01.mp4] to [Alias/Season 1-2/Alias - 1x01 - Truth Be Told.mp4]
[MOVE] from [Alias.2x01.mp4] to [Alias/Season 1-2/Alias - 2x01 - The Enemy Walks In.mp4]
:idea: Please read the FAQ and How to Request Help.

devster
Posts: 332
Joined: 06 Jun 2017, 22:56

Re: Reference for model binding

Post by devster » 19 Feb 2018, 22:46

Ok, now I understand. This viewtopic.php?f=5&t=5683 (and other posts by him), use the binding quite a lot.

If I understand correctly though, this only allows access to the currently processed batch, and not, for example, to files already present in the destination directory.

So in your example if I wanted the same output but I had already processed the 1st season I would need to post-process it again, correct?
This is slightly offtopic, but in this case would the xattr be modified again?
So, first run net.filebot.filename = Alias.1x01.mp4, second run net.filebot.filename = Alias - 1x01 - Truth Be Told.mp4.
I only work in black and sometimes very, very dark grey. (Batman)

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

Re: Reference for model binding

Post by rednoah » 20 Feb 2018, 02:38

{model} does indeed only consider the current batch (i.e. whatever is visible in the FileBot window) and not previously renamed files.

If you process files that have already been processed and thus won't be moved or copied because they're already were they need to be, xattr will still be written, so file attributes may change in response to that.
:idea: Please read the FAQ and How to Request Help.

Post Reply