Including additions within a derive. Trailing chars missing on empty edition

All about user-defined episode / movie / file name format expressions
Post Reply
ibcservices
Posts: 10
Joined: 16 Jul 2024, 18:45

Including additions within a derive. Trailing chars missing on empty edition

Post by ibcservices »

Hello, love filbert. First question I am posting. I am trying to add extra data to the filenames so I can easily see their info. When I try to add the "edition" to the name, it works when a movie has a special edition. However, the problem that I am having is that when there is no edition value, a lot of my file name strings are missing from the output. I cannot figure out why. Could someone help me with my code please?
I have looked at many a forum and tried so many code variations, I am lost at this point.

Here is my code:

Groovy: Select all

_sortedmovies/{plex.derive{" {tmdb-$id} {${ (${tags.first()}}) ?: ‘{edition-${tags.first()}}’},$certification,$rating,$hours,$vf,$vcf,$vc,$acf,$resolution,$bitrate]}"}}
Thank you in advance!
User avatar
rednoah
The Source
Posts: 24009
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Including additions within a derive. Trailing chars missing on empty edition

Post by rednoah »

:idea: Learn how {expressions} work and useful Helper Functions will explain why you get no value when your top-level {...} expression fails, e.g. due to undefined variables.



:idea: If you want to inject information into the {plex} binding then you will want to do it like so to allow for one of edition or vf|vc|ac to be undefined:
rednoah wrote: 12 Sep 2016, 10:03 e.g. Avatar (2009) {tmdb-19995}/Avatar (2009) {edition-Extended Edition} [720p, x264, AAC]

Format: Select all

{ ~plex.id % { " {edition-$edition}" } % { " [$vf, $vc, $ac]" } }

:idea: tags and certification being undefined is common. Your format will want to account for that at the very least.
:idea: Please read the FAQ and How to Request Help.
ibcservices
Posts: 10
Joined: 16 Jul 2024, 18:45

Re: Including additions within a derive. Trailing chars missing on empty edition

Post by ibcservices »

Thanks so much, Noah! Appreciate ya!! FIlebot rules.

Here is the code I ended up with for movies.

Groovy: Select all

/Volumes/plexmedia/Movies/{collection}/{ ~plex ** { " {edition-$edition}" } ** { " {tmdb-$id}" }  % { " [${genres[0]}"} % {",$certification"} % {",$rating"} % {",$hours"} % {",$vf"} % {",$vcf"} % {",$vc"} % {",$acf"} % {",$resolution"} % {",$bitrate]"} }

As a beginner, I would ask if you have any advice that would save me time from learning more lessons the hard way? This is my 3rd time restructuring my files due to learning more about Plex naming standards.
User avatar
rednoah
The Source
Posts: 24009
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Including additions within a derive. Trailing chars missing on empty edition

Post by rednoah »

ibcservices wrote: 17 Jul 2024, 07:51 As a beginner, I would ask if you have any advice that would save me time from learning more lessons the hard way? This is my 3rd time restructuring my files due to learning more about Plex naming standards.
I'd strictly stick to the Plex Naming Scheme. I see you're adding a {collection} folder. If the Plex Naming Scheme specification does not explicitly say that you can do that, then you cannot do that.


:idea: The {plex} format you will want to use is thus simply:

Format: Select all

/Volumes/plexmedia/{plex.id}

:idea: If you have the same movie in multiple editions / multiple video formats / etc then you can add information at the end of the file path (not in the middle somewhere; i.e. not in the movie folder name) to ensure that each file has a unique file name.


:idea: You can of course always ignore the Plex standard a bit here or there, to name things more according to your own preferences, and it probably might work mostly. But do understand that when you stray (ideally knowingly for a purpose; not unknowingly) from the path then you do create room for error.


:idea: Note that you can have the same files at multiple file paths without using additional disk space by using hardlinks. You thus can create a pristine structure for Plex and and a completely different structure for yourself as needed. Please read Re-process previously organized files using local xattr metadata.
:idea: Please read the FAQ and How to Request Help.
ibcservices
Posts: 10
Joined: 16 Jul 2024, 18:45

Re: Including additions within a derive. Trailing chars missing on empty edition

Post by ibcservices »

Awesome. I will definitely look into this hardlink. Thanks for all the help with this. Loving filebot.
Post Reply