Repository for neat file name string patterns and tagger script snippets

It’s possible to process the release as “Classical” as explained in the comments in the file itself:

#  For tagging and filing classical music using the Classical file
#  naming scheme, a user script must be enabled that sets the
#  _isClassical processing flag.

This would require the creation of a one-line script (under the “scripting” section) containing $set(_isClassical,1). Then simply enable the script before you load a release that you want processed as classical. Note that the default resulting format will be:

#  Process as Classical
#	Format: /[Classical]/Album Artist/[year] Album/Disc-Track [Composer] Title

For anything more extensive, I strongly recommend that you look into the “Classical Extras” plugin by @MetaTunes, which will provide access to much more information.

1 Like

Good morning!

Just want to thank you again for all your help!

When I first read that in the comments of the script I did not understand it, so thank you for explaining it :smiley: I have now been able to set it to fit my needs exactly. I don’t think I’ll ever have a set with more than 9 disks so even if the disk numbers aren’t padded it’s no big deal. In such exceptions I can always pad them myself with batch file renamers and such, so not important. I LOVE not having to switch between Various and Single artist releases anymore, this script is great!

Thanks again for everything @rdswift nad to the whole community!

1 Like

Here’s a small change that should take care of that for you automatically:

$noop(
-----------------------------------------------------------------------
-  Automatically pad disc and track numbers to the length of the total
-  number of discs and tracks.
-----------------------------------------------------------------------
)
$set(_PaddedDiscNum,$num($if2(%discnumber%,1),$len($if2(%totaldiscs%,1))))
$set(_PaddedTrackNum,$num($if2(%totaltracks%,1),$len($if2(%totaltracks%,1))))
1 Like

Wow thanks for that!

I just added it to between setting the file path and setting the file name sections and it didn’t work. The files were renamed as before. Where should I place it?

I tweaked this a bit to deal with effective bit rates higher than 3 places. (999)
I also did away with the CBR table.

$noop(############## Determine Bit Rate Integer Value #############)

$if($eq(%_devMode%,1),$set(_intBitRate,$rreplace(%_biitrate%,\\.\\d*\$,)),$set(_intBitRate,$rreplace(%_bitrate%,\\.\\d*\$,)))

$if($eq(%_devMode%,1),$set(_bitRateSpeed,%_saample_rate%KHz),$set(_bitRateSpeed,%_sample_rate%KHz))
$if($eq(%_devMode%,1),$set(_bitsPerSample,[%_biits_per_sample%]bit),$set(_bitsPerSample,[%_bits_per_sample%]bit))
$if($eq(%_devMode%,1),$set(_audioChannels,%_chaannels%ch),$set(_audioChannels,%_channels%ch))
$if($eq(%_devMode%,1),$set(_titleForFilename,%_tiitle%),$set(_titleForFilename,%title%))

$set(_bitRateType,$if($eq_any(%_intBitRate%,320,256,224,192,160,128,112,96,80,64,48,40,32,24,16,8),CBR$set(_cbrRateValue,%_intBitRate%)$set(_fileCBRRate,%_intBitRate%),VBR$set(_vbrRateValue,%_intBitRate%)))

$noop(Bitrate factors of 8.0 are most likely CBR with the remainder being VBR)

$if($eq(%_bitRateType%,VBR),
$if($gt(%_vbrRateValue%,339),$set(_fileVBRRate,320+),
$if($gt(%_vbrRateValue%,319),$set(_fileVBRRate,320),
$if($gt(%_vbrRateValue%,260),$set(_fileVBRRate,V0+),
$if($gt(%_vbrRateValue%,220),$set(_fileVBRRate,V0),
$if($gt(%_vbrRateValue%,191),$set(_fileVBRRate,V1),
$if($gt(%_vbrRateValue%,170),$set(_fileVBRRate,V2),
$if($gt(%_vbrRateValue%,150),$set(_fileVBRRate,V3),
$if($gt(%_vbrRateValue%,140),$set(_fileVBRRate,V4),
$if($gt(%_vbrRateValue%,130),$set(_fileVBRRate,V5),
$if($gt(%_vbrRateValue%,120),$set(_fileVBRRate,V6),
$set(_fileVBRRate,%_intBitRate%)
)))))))))))
$noop(######### File Naming Structure Variables Complete #########)

$noop(★ Pathname Generation Starts Here ★)

To Display values higher than what I’m calling ‘V0+’, 320, etc. You’ll need to add in an additional if-greater-than line with it’s accompanying parenthesis closing on the ))))))) line… and modify the ranges as desired.

Since Bit Rate is most commonly associated with MP3, I’m just accounting for those effective ranges when I’m applying the value to other than MP3 encoded files.

It’s generally assumed that an M4A of similar BR Value is going to be of no less quality than the MP3 format.

Of course, all of this only absolutely comparable if you have control of the bit stream from the moment it’s sourced and the quality of that source.

You can encode a flexi-disc off the back of a cereal box using an apparatus consisting of a Dixie Cup attached to a sewing pin … being manually dragged around in a circle on the medium… using a full on Lossless format and it’s still going to sound just as atrocious. e.g.: Overkill.

So we just have to ‘trust’ our ‘sources’ of data streams … that someone didn’t take a 16K bit rate file and transcode it to 128K :slight_smile:

$noop(############## Determine Bit Rate Integer Value #############)

$if($eq(%_devMode%,1),$set(_intBitRate,$rreplace(%_biitrate%,\\.\\d*\$,)),$set(_intBitRate,$rreplace(%_bitrate%,\\.\\d*\$,)))

$if($eq(%_devMode%,1),$set(_bitRateSpeed,%_saample_rate%KHz),$set(_bitRateSpeed,%_sample_rate%KHz))
$if($eq(%_devMode%,1),$set(_bitsPerSample,[%_biits_per_sample%]bit),$set(_bitsPerSample,[%_bits_per_sample%]bit))
$if($eq(%_devMode%,1),$set(_audioChannels,%_chaannels%ch),$set(_audioChannels,%_channels%ch))
$if($eq(%_devMode%,1),$set(_titleForFilename,%_tiitle%),$set(_titleForFilename,%title%))

$set(_bitRateType,$if($eq_any(%_intBitRate%,320,256,224,192,160,128,112,96,80,64,48,40,32,24,16,8),CBR$set(_cbrRateValue,%_intBitRate%)$set(_fileCBRRate,%_intBitRate%),VBR$set(_vbrRateValue,%_intBitRate%)))

$noop(Bitrate factors of 8.0 are most likely CBR with the remainder being VBR)

$if($eq(%_bitRateType%,VBR),
$if($gt(%_vbrRateValue%,339),$set(_fileVBRRate,320+),
$if($gt(%_vbrRateValue%,319),$set(_fileVBRRate,320),
$if($gt(%_vbrRateValue%,260),$set(_fileVBRRate,V0+),
$if($gt(%_vbrRateValue%,220),$set(_fileVBRRate,V0),
$if($gt(%_vbrRateValue%,191),$set(_fileVBRRate,V1),
$if($gt(%_vbrRateValue%,170),$set(_fileVBRRate,V2),
$if($gt(%_vbrRateValue%,150),$set(_fileVBRRate,V3),
$if($gt(%_vbrRateValue%,140),$set(_fileVBRRate,V4),
$if($gt(%_vbrRateValue%,130),$set(_fileVBRRate,V5),
$if($gt(%_vbrRateValue%,120),$set(_fileVBRRate,V6),
$if($gt(%_vbrRateValue%,95),$set(_fileVBRRate,V7),
$if($gt(%_vbrRateValue%,69),$set(_fileVBRRate,V8),
$if($gt(%_vbrRateValue%,44),$set(_fileVBRRate,V9),
$set(_fileVBRRate,%_intBitRate%)
))))))))))))))
$noop(######### File Naming Structure Variables Complete #########)

$noop(★ Pathname Generation Starts Here ★)

I added an additional line denoting ‘320’ vs. greater than 320 as well as filled in the lower values of V7,V8,V9 and anything lower just shows the actual number.

Just fill out the table as desired.
The “Dev Mode” is so you can see what your script is doing while using the Scripting Editor on the File Naming Option Pane.

The VBR Values correspond with LAME encoding presets. For CBR, the only values we actually care about per the specification are those ones. Anything over 320 you’ll need to make an entry in the VBR table to have them show the Integer value.

$if($gt(%_vbrRateValue%,500),$set(_fileVBRRate,%_intBitRate%)

If you want to see the actual file rate including anything past the decimal then put:

$if($gt(%_vbrRateValue%,500),$set(_fileVBRRate,%_bitrate%)

I’ve added a whole bunch of stuff for final sorting to the
MBP YA Magic-Script that does more stuff too. script since what was posted above. It’s currently v2.6a

1 Like

Actually, this sets a different variable. To make it work with the earlier script, replace the entire “Initialize Working Variables” section with:

$noop(
#######################################################################
#
#  Initialize Working Variables
#
#######################################################################
)
$set(_nMedia,%media%)
$set(_nTotalDiscs,$if2(%totaldiscs%,1))
$set(_nDiscNum,$if2(%discnumber%,1))
$set(_nTotalTracks,$if2(%totaltracks%,1))
$set(_nTrackNum,$if2(%tracknumber%,1))
$set(_nAlbumArtistID,$if2(%musicbrainz_albumartistid%,%_kUnKnownArtistID%))
$set(_nInitial,~ $upper($firstalphachar(%_nFAAPS%,#)) ~/)

$noop(
-----------------------------------------------------------------------
-  If standardized primary album artist is different from credited
-  primary track artist [other than prefix] show in track file name.
-  Otherwise, show any additional credited track artists in track file
-  name.
-----------------------------------------------------------------------
)
$set(_tAlbumArtist,$lower($delprefix(%_nPAA%)))
$set(_tTrackArtist,$lower($delprefix(%_nPTA%)))
$if($eq(%_tAlbumArtist%,%_tTrackArtist%),
    $set(_nFeat,$if(%_nATA%, [feat. %_nATA%],)),
    $set(_nFeat, [%_nFTA%])
)
$noop(
-----------------------------------------------------------------------
-  Automatically pad disc and track numbers to the length of the total
-  number of discs and tracks.
-----------------------------------------------------------------------
)
$set(_PaddedDiscNum,$num($if2(%discnumber%,1),$len($if2(%totaldiscs%,1))))
$set(_PaddedTrackNum,$num($if2(%totaltracks%,1),$len($if2(%totaltracks%,1))))
$set(_nYear,[$left($if2(%originaldate%,%originalyear%,%date%,0000),4)])
$set(_nTNum,$if($gt(%_nTotalDiscs%,1),%_PaddedDiscNum%-,)%_PaddedTrackNum%)

2 Likes

Because this thread is starting to get a bit long with extracts and updates of snippets and scripts, I have created a public repository on GitHub to make the scripts and snippets available. This repository is intended to augment, rather than replace, this thread. By maintaining it as a git repository, the scripts and snippets can be easily updated and the user is always presented with the most up-to-date version.

The repository is currently pretty bare, containing only my naming script and snippet for auto padding disc and track numbers, but I’m hoping that others will consider using it to share their work as well. Thanks.

8 Likes

Repository looks great! I’m sure it’ll make an excellent complement to this thread.

I still can’t seem to get the padded disc thing to work… I replaced the entire “Initialize Working Variables” section with it but the disc numbers are still not padded :thinking:

Actually, after some further testing I noticed that the files are now being named “(unpadded) disc - TOTAL tracks - Title” so the specific track number is no longer appearing. Now they all have the same track number…

Now that is strange. If you can send a copy of the naming script that you’re using to me at email address removed, I’ll have a look and see if I can get it working for you.

Note that the disc number will only be padded if the total number of discs is greater than 9. Same thing with the track numbers.

EDIT: No need to send me anything. You flushed out a bug in the code. If you change the line from $set(_PaddedTrackNum,$num($if2(%totaltracks%,1),$len($if2(%totaltracks%,1)))) to $set(_PaddedTrackNum,$num($if2(%tracknumber%,1),$len($if2(%totaltracks%,1)))) that should do the trick. Sorry about that.

2 Likes

Thank you, that did it! :smiley:

Also, I didn’t realize that it was only meant to show a padded number if there were more than 9 discs. I was testing on 4 and 5 disc sets. It’s perfect, thanks again!

1 Like

Hi!

I’m back again with another question about this script. Sorry to be so annoying! Is there a change I can make so that all soundtracks end up in the [Soundtracks] folder? As it stands now, only Soundtracks with Various Artists end up in that folder, so certain albums end up under the hardly known artist name. For example:
Sherlock Soundtrack or Wizard Of Oz Soundtrack which appear under the same artist/album artist for all tracks.

Any suggestions would be appreciated, thanks!

Just in case, this is what my script looks like right now, adapted from your original:

$noop(
#######################################################################
#
#  Picard File Naming Script                               2019-01-31
#  Bob Swift [rdswift]
#
#  License: GPLv3.0
#
#######################################################################
#
#  This script relies on inputs provided by the "Additional Artists
#  Variables" plugin.  This plugin is freely available for use under
#  GPL-2.0 or later, and the latest version can be downloaded from the
#  author's repository at:
#
#	 https://github.com/rdswift/picard-plugins/tree/2.0_RDS_Plugins
#
#  For tagging and filing classical music using the Classical file
#  naming scheme, a user script must be enabled that sets the
#  _isClassical processing flag.
#
#  Additional variables provided are:
#
#  Album Variables
#  
#      _artists_album_primary_id - The ID of the primary / first album artist listed
#      _artists_album_primary_std - The primary / first album artist listed [standardized]
#      _artists_album_primary_cred - The primary / first album artist listed [as credited]
#      _artists_album_primary_sort - The primary / first album artist listed [sort name]
#      _artists_album_additional_id - The IDs of all album artists listed except for the primary / first artist, separated by a semicolon and space
#      _artists_album_additional_std - All album artists listed [standardized] except for the primary / first artist, separated with strings provided from the release entry
#      _artists_album_additional_cred - All album artists listed [as credited] except for the primary / first artist, separated with strings provided from the release entry
#      _artists_album_all_std - All album artists listed [standardized], separated with strings provided from the release entry
#      _artists_album_all_cred - All album artists listed [as credited], separated with strings provided from the release entry
#      _artists_album_all_sort - All album artists listed [sort names], separated with strings provided from the release entry
#      _artists_album_all_sort_primary - The primary / first album artist listed [sort name] followed by all additional album artists [standardized], separated with strings provided from the release entry
#      _artists_album_all_count - The number of artists listed as album artists
#  
#  Track Variables
#  
#      _artists_track_primary_id - The ID of the primary / first track artist listed
#      _artists_track_primary_std - The primary / first track artist listed [standardized]
#      _artists_track_primary_cred - The primary / first track artist listed [as credited]
#      _artists_track_primary_sort - The primary / first track artist listed [sort name]
#      _artists_track_additional_id - The IDs of all track artists listed except for the primary / first artist, separated by a semicolon and space
#      _artists_track_additional_std - All track artists listed [standardized] except for the primary / first artist, separated with strings provided from the track entry
#      _artists_track_additional_cred - All track artists listed [as credited] except for the primary / first artist, separated with strings provided from the track entry
#      _artists_track_all_std - All track artists listed [standardized], separated with strings provided from the track entry
#      _artists_track_all_cred - All track artists listed [as credited], separated with strings provided from the track entry
#      _artists_track_all_sort - All track artists listed [sort names], separated with strings provided from the track entry
#      _artists_track_all_sort_primary - The primary / first track artist listed [sort name] followed by all additional track artists [standardized], separated with strings provided from the track entry
#      _artists_track_all_count - The number of artists listed as track artists
#
#######################################################################
)

$noop(Test Values
   $set(_outputpath,PATH)
   $set(_outputfilename,FILENAME)
)


$noop(
#######################################################################
#
#  Constants
#
#######################################################################
)
$set(_cUnknownArtistID,125ec42a-7229-4250-afc5-e057484327fe)
$set(_cVariousArtistID,89ad4ac3-39f7-470e-963a-56509c546377)
$set(_cUnknownArtist,[Unknown Artist])
$set(_cVariousArtist,[Various Artists])
$set(_cUnknownAlbum,[Unknown Album])
$set(_cNoTitle,[Unknown Title])
$set(_cClassical,[Classical])
$set(_cSoundtrack,[Soundtracks])
$set(_cSingles,[Singles])
$set(_aTitleMaxLength,65)
$set(_tTitleMaxLength,65)
$set(_tFilenameMaxLength,120)


$noop(
#######################################################################
#
#  Defaults if "Additional Artists Variables" plugin not loaded or metadata is missing
#
#######################################################################
)
$set(_nFAA,$if2(%_artists_album_all_std%,%albumartist%,%_cUnknownArtist%))
$set(_nPAA,$if2(%_artists_album_primary_std%,%albumartist%,%_cUnknownArtist%))
$set(_nFAAS,$if2(%_artists_album_all_sort%,%albumartistsort%,%_cUnknownArtist%))
$set(_nPAAS,$if2(%_artists_album_primary_sort%,%albumartistsort%,%_cUnknownArtist%))
$set(_nFAAPS,$if2(%_artists_album_all_sort_primary%,%albumartistsort%,%_cUnknownArtist%))

$set(_nPTA,$if2(%_artists_track_primary_cred%,%artist%,%_cUnknownArtist%))
$set(_nATA,%_artists_track_additional_cred%)
$set(_nFTA,$if2(%_artists_track_all_cred%,%artist%,%_cUnknownArtist%))

$set(_nAN,$if2(%album%,%_cUnknownAlbum%))
$set(_nANT,$if2(%album%,%_cUnknownAlbum%))

$set(_nTN,$if2(%title%,%_cNoTitle%))
$set(_nTNT,$if2(%title%,%_cNoTitle%))

$noop(
-----------------------------------------------------------------------
-  Trim the album and track names used to create directories and tracks
-  if they are longer than the maximum lengths set in the "Constants"
-  section.
-----------------------------------------------------------------------
)
$if($gt($len(%_nANT%),%_aTitleMaxLength%),$set(_nANT,$left(%_nANT%,$sub(%_aTitleMaxLength%,3))...))
$if($gt($len(%_nTNT%),%_tTitleMaxLength%),$set(_nTNT,$left(%_nTNT%,$sub(%_tTitleMaxLength%,3))...))


$noop(
#######################################################################
#
#  RegEx Constants
#
#######################################################################
)
$set(_reCaseInsensitive,\(?i\))


$noop(
#######################################################################
#
#  Initialize Working Variables
#
#######################################################################
)
$set(_nMedia,%media%)
$set(_nTotalDiscs,$if2(%totaldiscs%,1))
$set(_nDiscNum,$if2(%discnumber%,1))
$set(_nTotalTracks,$if2(%totaltracks%,1))
$set(_nTrackNum,$if2(%tracknumber%,1))
$set(_nAlbumArtistID,$if2(%musicbrainz_albumartistid%,%_kUnKnownArtistID%))
$set(_nInitial,~ $upper($firstalphachar(%_nFAAPS%,#)) ~/)

$noop(
-----------------------------------------------------------------------
-  If standardized primary album artist is different from credited
-  primary track artist [other than prefix] show in track file name.
-  Otherwise, show any additional credited track artists in track file
-  name.
-----------------------------------------------------------------------
)
$set(_tAlbumArtist,$lower($delprefix(%_nPAA%)))
$set(_tTrackArtist,$lower($delprefix(%_nPTA%)))
$if($eq(%_tAlbumArtist%,%_tTrackArtist%),
    $set(_nFeat,$if(%_nATA%, [feat. %_nATA%],)),
    $set(_nFeat, [%_nFTA%])
)
$noop(
-----------------------------------------------------------------------
-  Automatically pad disc and track numbers to the length of the total
-  number of discs and tracks.
-----------------------------------------------------------------------
)
$set(_PaddedDiscNum,$num($if2(%discnumber%,1),$len($if2(%totaldiscs%,1))))
$set(_PaddedTrackNum,$num($if2(%tracknumber%,1),$len($if2(%totaltracks%,1))))
$set(_nYear,[$left($if2(%originaldate%,%originalyear%,%date%,0000),4)])
$set(_nTNum,$if($gt(%_nTotalDiscs%,1),%_PaddedDiscNum%-,)%_PaddedTrackNum%)

$noop(
#######################################################################
#
#  Set Album Type [Single, Soundtrack, Classical or Standard]
#
#  Process as Classical
#	Format: /[Classical]/Album Artist/[year] Album/Disc-Track [Composer] Title
#
#  Process as Soundtrack
#	Format: /[Soundtrack]/[year] Album/Disc-Track Title [Artist]
#
#  Process as Single
#	Formats: Album Artist/[Singles]/[year] Title [feat.]
#
#  Process as Standard
#	Formats: Album Artist/[year] Album/Disc-Track Title [feat.]
#                Album Artist/[year] Album/Disc-Track Title [feat.]
#            /[Various Artists]/[year] Album/Disc-Track Title [Artist]
#            /[Unknown Artists]/[year] Album/Disc-Track Title [Artist]
#
#######################################################################
)
$noop($if($and($lte(%_nTotalDiscs%,1),$lte(%_nTotalTracks%,1),$in(%_primaryreleasetype%,single)),$set(_nAlbumType,Single)))
$set(_t1,1=)
$set(_t1,%_t1%$if($lte(%_nTotalDiscs%,1),Y,N))
$set(_t1,%_t1%$if($lte(%_nTotalTracks%,1),Y,N))
$set(_t1,%_t1%$if($in(%_primaryreleasetype%,single),Y,N))
$if($eq(%_t1%,1=YYY),$set(_nAlbumType,Single))

$noop($if($and($eq($if2(%_nAlbumArtistID%,%_cVariousArtistID%),%_cVariousArtistID%),$in(%_secondaryreleasetype%,soundtrack)),$set(_nAlbumType,$if2(%_nAlbumType%,Soundtrack))))
$set(_t2,2=)
$set(_t2,%_t2%$if($eq(%_nAlbumArtistID%,%_cVariousArtistID%),Y,N))
$set(_t2,%_t2%$if($in(%_secondaryreleasetype%,soundtrack),Y,N))
$if($eq(%_t2%,2=YY),$set(_nAlbumType,Soundtrack))


$noop($set(_nYear,%_nYear% [%_t1%\,%_t2%]))


$if(%_isClassical%,$set(_nAlbumType,$if2(%_nAlbumType%,Classical)))
$set(_nAlbumType,$if2(%_nAlbumType%,Standard))


$noop(
#######################################################################
#
#  Set File Path
#
#######################################################################
)
$if($eq(%_nAlbumType%,Classical),$set(_nFilePath,%_cClassical%/%_nFAAPS%/%_nYear% %_nANT%/))
$if($eq(%_nAlbumType%,Soundtrack),$set(_nFilePath,%_cSoundtrack%/%_nYear% %_nANT%/))
$if($eq(%_nAlbumType%,Single),$set(_nFilePath,%_nPAAS%/%_cSingles%/))
$if($eq(%_nAlbumType%,Standard),$if($eq($if2(%musicbrainz_albumartistid%,%_cVariousArtistID%),%_cVariousArtistID%),
    $set(_nFilePath,%_cVariousArtist%/%_nYear% %_nANT%/),
    $if($eq($if2(%musicbrainz_albumartistid%,%_cUnknownArtistID%),%_cUnknownArtistID%),
        $set(_nFilePath,%_cUnknownArtist%/%_nYear% %_nANT%/),
        $set(_nFilePath,%_nFAAPS%/%albumartist% - %_nYear% %_nANT%/)
)))

$noop(
#######################################################################
#
#  Set File Name
#
#######################################################################
)
$if($eq(%_nAlbumType%,Classical),$set(_nFileName,%_nTNum% - %_nFeat% %_nTNT%))
$if($eq(%_nAlbumType%,Soundtrack),$set(_nFileName,%_nTNum% - %_nTNT%%_nFeat%))
$if($eq(%_nAlbumType%,Single),$set(_nFileName,%_nYear% - %albumartist% - %_nTNT%%_nFeat%))
$if($eq(%_nAlbumType%,Standard),$set(_nFileName,%_nTNum% - %albumartist% - %_nTNT%%_nFeat%))

$noop(
-----------------------------------------------------------------------
-  Trim the file name if it is longer than the maximum length set in
-  the "Constants" section.
-----------------------------------------------------------------------
)
$if($gt($len(%_nFileName%),%_tFilenameMaxLength%),$set(_nFileName,$left(%_nFileName%,$sub(%_tFilenameMaxLength%,3))...))


$noop(
#######################################################################
#
#  Note that some of these replacements revert back to an underscore
#  because of processing for Windows compatability.
#
#######################################################################
)
$noop(
$set(_fnAlbumArtist,$rreplace(%_fnAlbumArtist%,/,•))
$set(_fnAlbumArtist,$rreplace(%_fnAlbumArtist%,:,ː))
$set(_fnAlbumArtist,$rreplace(%_fnAlbumArtist%,[.]3,…))
$set(_fnAlbumArtist,$rreplace(%_fnAlbumArtist%,[.]2_,…))
$set(_fnAlbumArtist,$rreplace(%_fnAlbumArtist%,[._]*\$,))
$set(_wAlbum,$rreplace(%_wAlbum%,:,ː))
$set(_wAlbum,$rreplace(%_wAlbum%,/,•))
$set(_wAlbum,$rreplace(%_wAlbum%,[._]*\$,))
$set(_wTitle,$rreplace(%_wTitle%,:,ː))
)


$noop(
#######################################################################
#
#  Output the path and file name to use.
#
#######################################################################
)

$noop(
$set(OutputPath,%_nFilePath%)
$set(OutputFileName,%_nFileName%)
)

$rreplace(%_nFilePath%/%_nFileName%,[<>?*:;\\_"]+,)

$noop(
#######################################################################
#
#  End of script.
#
#######################################################################
)

It should be easy enough. Try changing the line:

$if($eq(%_t2%,2=YY),$set(_nAlbumType,Soundtrack))

to:

$if($in(%_secondaryreleasetype%,soundtrack),$set(_nAlbumType,Soundtrack))

and see if that does what you want.

3 Likes

Ha! that worked, thank you!

Any thoughts on why it would not add the artist name at the end of the track like it does for all the others? it just adds a featured artists if there is one… :thinking:

As set, it should only add the artist name on a track if it is different from the album artist name. That was always the case when the albums were also “Various Artists”.

Oh, that explains it, thank you!

If you wanted to always include the artist name on the soundtrack track file names, then you should add:

$if($in(%_secondaryreleasetype%,soundtrack),$set(_nFeat, [%_nFTA%]))

immediately after:

$if($eq(%_tAlbumArtist%,%_tTrackArtist%),
    $set(_nFeat,$if(%_nATA%, [feat. %_nATA%],)),
    $set(_nFeat, [%_nFTA%])
)

Note that I haven’t tested this.

2 Likes

I just tried it, and it worked perfectly. You rock! :smiley:

I am so happy on how much easier this script has made my life lol. Thanks again!

1 Like

Hi @rdswift not sure if this would be a question for you and your script, or one I should ask elsewhere, in general.

This album (Wizard Of Oz) mentioned before is a soundtrack. All tracks appear under on Album Artist (Harold Arlen). However, the recording artists vary from track to track. For example, track 2 “Over the Rainbow” has Judy Garland as the recording artist, since she’s the one actually singing the song. Is there a way to pull that information from the MB server to use in the renaming script? if so, what would be the tag? (ie. %recordingartist%)?

Thanks for your help and guidance!

I believe that Picard only exposes the track artists as listed on the release. To get the artists from the associated recordings, I suspect that you’ll need to use a plugin such as “Classical Extras”.