Conditionally add release year based on album artist brainfart

I had such a good script but the computer I set it up on died. I’m trying to recreate what I did there and having the shietiest time of it.

For Various Artist albums, I do not want the release year. The rest of my collection, yes, of course I want it. I just do not usually look for soundtracks by their year, so I want those different.

Desired outcome example:
/Various Artists/Tank Girl/03-Girl U Want.mp3
/Alabama Shakes/2012-Boys & Girls/01-Hold On.mp3

I’m pretty sure my VariousArtistsCheck is what is wrong. I think I need to have something different there to have that read correctly but I don’t know enough to know what to search in the documentation. I tried surrounding it with single and double quotes and that didn’t seem to work. My if is always resolving to false.

$set(VariousArtistCheck, Various Artists)

$set(YearAlbum,$if($eq(%albumartist%,%VariousArtistCheck%),$left(%date%,4)-%album%,%album%))

It was the space. Jesus in heaven.

no workie
$set(VariousArtistCheck, Various Artists)

workie
$set(VariousArtistCheck,Various Artists)

I really hate myself sometimes.

2 Likes

In case anyone ever finds this and wants to do something similar, here’s my script so far:

$set(VariousArtistCheck,Various Artists)
$set(AlphabeticalFolderOn,-= $upper($left(%albumartist%,1)) =-/)
$set(AlphabeticalFolderOff,)
$set(ArtistSort,$replace($rreplace(%albumartistsort%,[_:],-),?,)/)
$set(YearAlbum,$if($not($eq(%albumartist%,%VariousArtistCheck%)),$left(%date%,4) - %album%,%album%))
$set(DiscFolder,$if($gt(%totaldiscs%,1),Disc $num(%discnumber%,1)/)
$set(Track, $if($gt(%totaldiscs%,1), $num(%discnumber%,1) - )$num(%tracknumber%,2) - ))
$set(Title,%title%$if($eq(%albumartist%,%VariousArtistCheck%), \(%artists%\)))

%AlphabeticalFolderOff%
%ArtistSort%
%YearAlbum%/
%DiscFolder%
%Track%
%Title%

I go back and forth on the parent alphabet folder, so having a present on/off for it is convenient.

Example output currently:
/Various Artists/Tank Girl/03-Girl U Want (DEVO).mp3
/Alabama Shakes/2012-Boys & Girls/01-Hold On.mp3

Yes, the scripting language is quite sensitive to spaces. The “everything is a string” approach in the scripting makes it often easier to use and more accessible to non-programmers, but it can really hurt readability and conflict with your intuition if you are used at formatting other programming languages

2 Likes

for sure! Running albums through this now and it appears to be working as expected. I should probably go through and remove those extra spaces though. for consistency.