Help with file naming with special rule for soundtracks

Can I piggyback on this and ask for some help as well? I want to organize my files into the following structure:

[AlbumArtist] \ [Album] \ [TrackNumber] - [Title]

However, if it’s a soundtrack, I want it to be named as following:

[Language] \ Soundtracks\ [Album] \ [TrackNumber] - [Title]

I came up with the following but it’s not quite correct. It’s not recognizing the release type of album/soundtrack correctly and everything gets organized under the [AlbumArtist] \ [Album] \ [TrackNumber] - [Title] structure. I tried just using soundtrack as the value for the releasetype variable and had the same issue.

What am I missing?

$if($inmulti(%releasetype%,album/soundtrack),Soundtrack/%_releaselanguage%/%album%/%tracknumber% - %title%,%albumartist%/%album%/%tracknumber% - %title%)

Secondly, when I tried it without the soundtrack variable, it worked correctly but the language name was truncated - hin instead of Hindi, for example. How can I fix that?

I think the problem is that your “Soundtrack” test was checking for “album/soundtrack” in %releasetype%. I’m not sure that “album/soundtrack” is a valid option or that $inmulti() is the right test. Try changing that to check for “soundtrack” in %releasetype% simply using $in() instead.

I’ve taken the liberty of revising your script a little to reflect this change, as well as removing some of the duplication around [Album] \ [TrackNumber] - [Title]. I’ve also set it to default to “und” (Undetermined) if there is no release language specified. Have a look at this and see if it correctly processes the soundtracks for you:

$if($in(%releasetype%,soundtrack),$if2(%_releaselanguage%,und)/Soundtrack,%albumartist%)/%album%/$num(%tracknumber%,2) - %title%

I don’t think this will be very easy to fix because the values returned by %_releaselanguage% are the ISO 639-3 values, which appear to be three character identifiers. To display the full language title, you would need some sort of function to map the three-character identifier to the full language title. I suspect that would be easier to implement in a plugin rather than a script.

2 Likes

@TestyTest, in case you really wanted the full language titles rather than just the three letter code, I threw together a plugin to provide the full language title as a new tag variable %_releaselanguagetitle%. You can download the plugin here, and then install and enable it in Picard.

Your new naming script would look something like:

$if($in(%releasetype%,soundtrack),$if2(%_releaselanguagetitle%,%_releaselanguage%,Unknown)/Soundtrack,%albumartist%)/%album%/$num(%tracknumber%,2) - %title%

I hope this helps you get a bit closer to what you’re wanting for your file naming.

1 Like