Author Topic: File Naming  (Read 732 times)

wildwanderer

  • Newbie
  • *
  • Posts: 3
Hello. I'm having difficulties getting my file naming template set up correctly. In plain text, here's what I'm trying to achieve:

Album Artist (sorted so "A" and "The" are shown at the end as in "Red Hot Chili Peppers, The")
subfolder
Album (again, sorted)
[space] (if there's an album year present)
Album Year in yyyy (don't show if null)
subfolder
DiscCount (don't show if less than 2)
- (a dash, if DiscCount is shown)
Track#
[space]
Title (not sorted)

The following fails in the template editor:
$Sort<Album Artist>\$Sort<Album>$If($IsNull(<Year (yyyy)>,, (<Year (yyyy)>))\$If(<Disc Count><2,,$IsNull(<Disc#>,,<Disc#>))<Track#><Title>

Some examples to help illustrate (backslashes indicate folders, and I added "The" in some spots just to help illustrate):

White Stripes, The/Elephant, The (2003)/1 The Seven Nation Army.mp3

If the song was on disc 2 and there wasn't a year in the metadata, it would be:
White Stripes, The/Elephant, The/2-1 The Seven Nation Army.mp3

Thanks for the help!

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1014
  • Heal The World
Hello wildwanderer, welcome to the forum.

Haven't looked into all of it yet, but a quick-paste of the code into the virtual tag template editor indicates that the formula first fails @ $Sort<Album Artist>.
Try it with the tag enclosed in brackets like this: $Sort(<Album Artist>).

Edit: This seems to work for me.

Code
$Sort(<Album Artist>)\$Sort(<Album>)$IsNull(<Year (yyyy)>,, <Year (yyyy)>)\$If(<Disc Count><2,,<Disc Count>-)<Track#> <Title>
Last Edit: October 10, 2022, 06:03:20 PM by Mayibongwe
Favourite song at the moment:   Decode by Paramore

wildwanderer

  • Newbie
  • *
  • Posts: 3
Hello wildwanderer, welcome to the forum.

Haven't looked into all of it yet, but a quick-paste of the code into the virtual tag template editor indicates that the formula first fails @ $Sort<Album Artist>.
Try it with the tag enclosed in brackets like this: $Sort(<Album Artist>).

Edit: This seems to work for me.

Code
$Sort(<Album Artist>)\$Sort(<Album>)$IsNull(<Year (yyyy)>,, <Year (yyyy)>)\$If(<Disc Count><2,,<Disc Count>-)<Track#> <Title>

Thank you so much! The last thing remaining is I'm trying to get the year in parentheses. I tried the format below, but I get an extra closing parenthesis on albums with a null (empty) year. Any ideas?

Code
$Sort(<Album Artist>)\$Sort(<Album>)$IsNull(<Year (yyyy)>,, (<Year (yyyy)>))\$If(<Disc Count><2,,<Disc Count>-)<Track#> <Title>

Example: Luciano Pavarotti\O Holy Night)\02 Piet, Signore  

Mayibongwe

  • Sr. Member
  • ****
  • Posts: 1014
  • Heal The World
Sorry, I must have missed that part. This should work properly:
And incase you ever want to find out more about virtual tag functions: https://getmusicbee.com/forum/index.php?topic=35868.0

Code
$Sort(<Album Artist>)\$Sort(<Album>)$IsNull(<Year (yyyy)>,," ("<Year (yyyy)>")")\$If(<Disc Count><2,,<Disc Count>-)<Track#> <Title>
Favourite song at the moment:   Decode by Paramore

wildwanderer

  • Newbie
  • *
  • Posts: 3
Thanks again! I noticed that I a) was listing the disc count instead of the disc number, and b) had an extra space when there were null track numbers. This is what I ended up with:

Code
$Sort(<Album Artist>)\$Sort(<Album>)$IsNull(<Year (yyyy)>,," ("<Year (yyyy)>")")\$If(<Disc Count><2,,<Disc#>-)$IsNull(<Track#>,,<Track#>" ")<Title>

I think I'm exactly where I wanted to be. Appreciate the help!