Dear community, can someone please have a look at what could be wrong with my script?
$if2(%albumartistsort%,%artistsort%,%artist%)
/
$if(
$if2(%albumsort%,%album%),
[$if2(%originalyear%,%year%)] $if2(%albumsort%,%album%),
[] Unreleased
)
$if(
$if($in(%releasetype%,album),
$if($in(%releasetype%,soundtrack), \[Soundtrack\])
$if($in(%releasetype%,single), \[Single\])
$if($in(%releasetype%,ep), \[EP\])
){%musicbrainz_albumid%}
/
$if($gt(%totaldiscs%,1),%discnumber%-,)
$if(%tracknumber%,$num(%tracknumber%,2) ,)
$if(%artist%,%artist% - ,)
$if2(%titlesort%,%title%)
It seems to me that the middle part of the script breaks it. This is the part which:
- adds [Single], [EP] or [Soundtrack] to folder name if the release is singe, ep or soundtrack. If release is album the release type is not added to the folder name
- always adds {musicbrainz album ID} at the very end of the folder name, regardless of the release type
Picard returns error message when I try this script: Unexpected character ‘[’
Thank you a lot for your advice guys!
1 Like
My advice is to stay as far away from ChatGPT and other AI services as possible when it comes to scripting.
Now that I’ve got that off my chest, try the following (untested code):
$if2(%albumartistsort%,%artistsort%,%artist%)/
$if2(%albumsort%,%album%)
[$if2(%originalyear%,%year%)]
$if2(%albumsort%,%album%)
$if($eq(%_primaryreleasetype%,soundtrack), \[Soundtrack\])
$if($eq(%_primaryreleasetype%,single), \[Single\])
$if($eq(%_primaryreleasetype%,ep), \[EP\])
{%musicbrainz_albumid%}/
$if($gt(%totaldiscs%,1),%discnumber%-)
$if(%tracknumber%,$num(%tracknumber%,2) )
$if2(%artistsort%,%artist%) -
$if2(%titlesort%,%title%)
7 Likes
Okay, I had a bit of time to look at this again this morning and I think I understand what you’re trying to do. The following script does not show any errors, and looks like it should do what you want:
$if2(%albumartistsort%,%artistsort%,%artist%)
/
$if(
$if2(%albumsort%,%album%),
[$if2(%originalyear%,%year%)] $if2(%albumsort%,%album%),
[] Unreleased
)
$if(
$in(%releasetype%,album),$if($in(%releasetype%,soundtrack), [Soundtrack]),
$if($in(%releasetype%,single), [Single])
$if($in(%releasetype%,ep), [EP])
){%musicbrainz_albumid%}
/
$if($gt(%totaldiscs%,1),%discnumber%-,)
$if(%tracknumber%,$num(%tracknumber%,2) ,)
$if(%artist%,%artist% - ,)
$if2(%titlesort%,%title%)
Edited to move the “soundtrack” check because it is only found in the secondary release type, and would never be shown if the primary release type was “album”.
2 Likes
Sir, you’re a magician… and just a good guy!
Thank you so much - works like a charm!
3 Likes