Saving Files by genre, albumartist, title

Tags: #<Tag:0x00007f58f80b0128> #<Tag:0x00007f58f80aff98>

Hello,
I am trying to save music in a tree structure of genre, albumartist, title. Right now I have the default script. When I add genre to the first line $if2(%genre%,%albumartist%,%artist%)/ It is saved “genre/albumtitle” with no artist name.

If I try to add it to the second line $if(%genre%,%albumartist%,%album%/,) I get an error in the script.

Any help would be most appreciated. I did search and read quite a bit and did not find the answer.

Thank you.

%genre%/$if(%albumartist%,%albumartist%,%artist%)/%album%/$if(%discnumber%,%discnumber%-)%tracknumber% - %artist% - %title%

In other words:
Genre
→ Album artist if available, else, track artist
->-> Album
->->-> Disc number if available, followed by track number, artist, and title

Play around and see which of these tags you really need, and for the $if functions, see if the relevant tags are always going to be present (which would be up to you), in which case you can do away with the function and pick which tag you like.

The $if function returns the second value if the first one is not empty. Otherwise, it returns the third value, or if not given it returns nothing. I reckon you thought you needed it. You don’t, in fact here’s a simplified one for you:

%genre%/%albumartist%/%title%

This one would do what you expected. But you won’t get the automatic niceties of my version. Play around and see what you need.

Also, report back, I didn’t try any of these out because I’m in bed

1 Like

Using just your first line in your reply in the script it saved as I would like. Using just the second line you have in your reply saves as “genre/artist/songs” album name is left out, so I will use your first line. Thank you for the prompt reply sorry to have bugged you in bed…

I did play a smidge and added the album to your line. I am setting up to repair my brothers database of music. 486gigs and most of it is shuffled so if we have the artist, album, and song in the name it will be easier to repair in the future.

Thank you,

%genre%/$if(%albumartist%,%albumartist%,%artist%)/%album%/$if(%discnumber%,%discnumber%-)%tracknumber% - %artist% - %album% - %title%

1 Like

It’s OK. I needed an excuse to stay up :grin: You’re welcome!

2 Likes

BTW,

$if(%albumartist%,%albumartist%,%artist%)

can be replaced with:

$if2(%albumartist%,%artist%)

$if2 uses the first non-null variable.

3 Likes