yellowdaemon wrote: ↑25 Jul 2023, 07:19
M:/TEST/Various Artists/[2023] - The Best Golden Oldies Album In The World...Ever!/81 - The Righteous Brothers - Unchained Melody
This file path does not match any of the previously posted media info?
"This is what I want" must match one of the media info tables you have previously posted, because all FileBot does is
"take information from the file, and generate a file path" and so that is the mindset we must put ourselves into when prototyping a format expression.
But let's say we're working with a file like this:
Properties: Select all
Title : Father And Son (Remastered 2020)
Album : The Best Golden Oldies Album In The World...Ever!
Album/Performer : Various Artists
Track : Father And Son (Remastered 2020)
Track/Position : 1
Track/Position_Total : 102
Performer : Cat Stevens
Composer : Cat Stevens
Recorded_Date : 2023-06-09
Code: Select all
M:/TEST/Various Artists/[2023] - The Best Golden Oldies Album In The World...Ever!/102 - Cat Stevens - Father And Son (Remastered 2020)
{n} = Various Artists because:
Properties: Select all
Album/Performer : Various Artists
{y} = 2023 because:
{album} = The Best Golden Oldies Album In The World...Ever! because:
Properties: Select all
Album : The Best Golden Oldies Album In The World...Ever!
{pi} = 102 because:
{artist} = Cat Stevens because:

If
{artist} is not what you want, then you can use
media.'Composer' instead, which may or may not yield a different value depending on the file at hand:
{t} = Father And Son (Remastered 2020) because:
Properties: Select all
Track : Father And Son (Remastered 2020)

If something works differently, then you'll want to follow these steps. Check the media info table. Check the values. FileBot uses these values. It's really really very simple. The complexity stems from different files using different media info properties, some missing, some not missing, some having long values you don't want, and that's where adding conditions in the code comes in, i.e. do different things for different files depending on the available information.
yellowdaemon wrote: ↑25 Jul 2023, 07:19
Where does this fit in the script?
{ media.'Album/Composer' ?: media.'Composer' } will give you
Album/Composer if defined and
Composer otherwise, exactly what it says in the media info table that you already know how to check. If you believe that files have misleading media info, then you know how to check for that too. You can put this piece of code wherever you want
"Album/Composer if defined and Composer otherwise" to appear in the file path. I believe you have the skills to do this by yourself at this point. Just give it a try. Play with it. It's not magic. It's just replacing variables with values. It'll make sense. You
can and will understand it if you give it a try.
Album/Composer means that you will probably want to use this snippet at the album folder level in your format:
Properties: Select all
Album/Performer : Various Artists

Since we have now learned
"A, or B if A is undefined" we can now re-apply the same knowledge to your
"I prefer the composer in the file name over the performer" use case and add this bit where your format generates the file name:
Properties: Select all
Performer : Cat Stevens
Composer : Cat Stevens