You are not logged in.
I use
File naming format:
$if2(%albumartistsort%,%artistsort%)/$if2(%albumartistsort%,%artistsort%) - %album%/%artistsort% - %title%
Multiple artist file naming format:
$if($eq(%albumartistsort%,%artistsort%),%albumartistsort%/%albumartistsort% - %album%/%artistsort% - %title%,%artistsort%/%artistsort% - %title%)
Example:
File name:
M:/Music/Tagged/Beatles, The/Beatles, The - Help/Beatles, The - Ticket to Ride.mp3
Multiple artist file name:
M:/Music/Tagged/Fantasys, The/Fantasys, The - Why_ Oh Why_.mp3
A little odd maybe, but I rely on %albumartistsort% and %artistsort% and require even files from VA albums to show up under the artist folder. (I also rely on Picard adding » (1)«, » (2)« and so forth to the file name if needed.)
VA albums are »held together« only by playlists (in M:/Music/Playlists/Albums/), databases and »media libraries« (broadcasting databases (mySQL); Logitech SqueezeCenter for private listening (mySQL); MusicIP Mixer; Winamp media library).
Last edited by Moonbase (2009-01-20 15:45:14)
Offline
Based on some of the posts in this thread and my modifications I use:
Single Artists
$rreplace($replace($rreplace($replace($replace($if2(%albumartistsort%,%artistsort%),...,…),/,-),\\.\$,$noop(.))/$rreplace($replace($replace($if2(%albumartist%,%artist%),...,…),/,-),\\.\$,$noop(.)) - $rreplace($replace(%album%,...,…),\\.\$,$noop(.))$if($if2(%originalyear%,%date%), [$left($if2(%originalyear%,%date%),4)])/$num(%tracknumber%,2) - $rreplace($replace($replace(%artist%,...,…),/,-),\\.\$,$noop(.)) - $replace(%title%,...,…),_,$noop(.)),[*|:"<>?],)
Multiple Artists
$rreplace($replace($if($eq(%albumartist%,Various Artists),AAVV,$rreplace($replace($replace($if2(%albumartistsort%,%artistsort%),...,…),/,-),\\.\$,$noop(.)))/$rreplace($replace($replace($if2(%albumartist%,%artist%),...,…),/,-),\\.\$,$noop(.)) - $rreplace($replace(%album%,...,…),\\.\$,$noop(.))$if($if2(%originalyear%,%date%), [$left($if2(%originalyear%,%date%),4)])/$num(%tracknumber%,2) - $rreplace($replace($replace(%artist%,...,…),/,-),\\.\$,$noop(.)) - $replace(%title%,...,…),_,$noop(.)),[*|:"<>?],)
Example:
File name:
Beatles, The\The Beatles - Help! [1965]\07 - The Beatles - Ticket to Ride.mp3
Multiple artist file name:
AAVV\Various Artists - Explosive Doowops, Volume 4 [1999]\05 - The Fantasy - Why Oh Why.mp3
The features of these strings are:
1) Unusable filename characters are removed so that no underscore replacement takes place (i.e. Why Oh Why.mp3 instead of Why_ Oh Why_.mp3)
2) All albums by an artist are collected within the directory using the artist sort name - however within such directory the standard artist name is used
3) The date of the album - if present - is included in the album directory at the end (otherwise omitted). This is done to avoid inconsistent naming between those albums with date information and those without
4) The artist name is kept within the actual filename of track so that were a single song to be extracted from an album the key information would still be available in the filename itself (the fact that the track number is at the very beginning of the file name is to facilitate its removal through manual editing if necessary)
On top of that the following benefits are included and were taken from previous posts:
a. If the ArtistName, AlbumName or TrackName contain a three-dot "..." sequence, it will be replaced with a true ellipsis "…"
b. If the ArtistName or AlbumName ends in a dot "." then that dot will be removed
c. Finally, any and all underscores "_" will be removed from the entire path
d. Multi-artist albums attributed to a specific artist will have files placed into the same directory structure as the single artist albums
EDIT NOTE
The string uses the option %originalyear% and, if not present, %date% to set the date of the album folder. Since the time I have posted the script I have decided to remove the %originalyear% and just use %date% for my personal use. I leave the script here as it is because it is a more complex script and can be easily modified, however it is important that people using it are aware of such choice.
----NEW STRING 23/07/2009---
Based on the discussion in another section of the forum (http://forums.musicbrainz.org/viewtopic … 7896#p7896) I have decided to create an alternative version of the previous string (minus the original year aspect) that groups all discs of a given release in the same release group.
The following strings require:
1. the Disc Numbers plugin (http://musicbrainz.org/doc/PicardQt/Plugins)
2. the Bonus Disc plugin (http://musicbrainz.org/doc/PicardQt/Plugins)
3. the following code added to the Scripting section of Picard
$if(%discnumber%,$set(albumdisc,$if(%discsubtitle%,%album% \(disc %discnumber% - %discsubtitle%\),%album% \(disc %discnumber%\)))) $if(%bonusdisc%,$set(albumdisc,$if(%bonusdisctitle%,%album% \(bonus disc - %bonusdisctitle%\),%album% \(bonus disc\))))
Once (1) to (3) have been carried out the strings are:
Single Artist
$replace($replace($replace($replace($replace($replace($replace($replace($replace($rreplace($replace($replace($if2(%albumartistsort%,%artistsort%),...,…),/,-),\\.\$,$noop(.))/$rreplace($replace($replace($if2(%albumartist%,%artist%),...,…),/,-),\\.\$,$noop(.)) - $rreplace($replace(%album%,...,…),\\.\$,$noop(.))$if(%date%, [$left(%date%,4)])/$if(%albumdisc%,$rreplace($replace($replace(%albumdisc%,...,…),/,-),\\.\$,$noop(.))/,)$num(%tracknumber%,2) - $rreplace($replace($replace(%artist%,...,…),/,-),\\.\$,$noop(.)) - $replace(%title%,...,…),_,$noop(.)),?,),_, ),*,x),:, -),",'),|, ),<,[),>,])
Multiple Artists
$replace($replace($replace($replace($replace($replace($replace($replace($replace($if($eq(%albumartist%,Various Artists),AAVV,$rreplace($replace($replace($if2(%albumartistsort%,%artistsort%),...,…),/,-),\\.\$,$noop(.)))/$rreplace($replace($replace($if2(%albumartist%,%artist%),...,…),/,-),\\.\$,$noop(.)) - $rreplace($replace(%album%,...,…),\\.\$,$noop(.))$if(%date%, [$left(%date%,4)])/$if(%albumdisc%,$rreplace($replace($replace(%albumdisc%,...,…),/,-),\\.\$,$noop(.))/,)$num(%tracknumber%,2) - $rreplace($replace($replace(%artist%,...,…),/,-),\\.\$,$noop(.)) - $replace(%title%,...,…),_,$noop(.)),?,),_, ),*,x),:, -),",'),|, ),<,[),>,])
As mentioned all the features of the original strings persists (but original year as explained in the previous edit) the additional feature provided by the changes is:
instead of
Beatles, The\The Beatles - Help! (disc 1: Just an example) [1965]\07 - The Beatles - Ticket to Ride.mp3
Beatles, The\The Beatles - Help! (disc 2: Just another example) [1965]\07 - The Beatles - Ticket to Ride.mp3
Beatles, The\The Beatles - Help! (bonus disc: why not) [1965]\07 - The Beatles - Ticket to Ride.mp3[/i]
the end result is
Beatles, The\The Beatles - Help! [1965]\Help! (disc 1 - Just an example)\07 - The Beatles - Ticket to Ride.mp3
Beatles, The\The Beatles - Help! [1965]\Help! (disc 2 - Just another example)\07 - The Beatles - Ticket to Ride.mp3
Beatles, The\The Beatles - Help! [1965]\Help! (bonus disc - why not)\07 - The Beatles - Ticket to Ride.mp3
Furthermore it also includes the updated replacement string developed by Kelani (http://forums.musicbrainz.org/viewtopic.php?id=1769)
Specifically:
? to <nothing>
_ to <space>
* to x (To note unreleased/demo tracks: 01. SomeBand - SuperSecret Track [x].mp3 )
: to <space>-
/ to - this specific replacement does not appear to work
I have also added the following replacements
" to '
| to <nothing>
< to [
> to ]
Last edited by rmagere (2009-07-23 18:34:38)
Offline
Thanks to everyone, especially Ullic Pendragon, for their code.
I was just having a problem with the renaming process - whenever Picard renames a file in the format laid out by Ullic Pendragon, and creates the new folders to accomodate it, if the file is in a folder within my general "music" folder, it creates the files in that folder instead of moving files out to the general directory.
For example, this is the course of a file 1.mp3:
starts here:
//music/Beirut - Holland/1.mp3
moves here:
//music/Beirut - Holland/[-=B=-]/Beirut/Holland/1.mp3
instead of
//music/[-=B=-]/Beirut/Holland/1.mp3
Can anyone help me correct this problem?
Thanks
Offline
Just a guess, but try checking that the value of Options > File Naming > Move Files > "Move tagged files to this directly" is set to //music, opposed to "."?
Offline
That took care of it. Thanks for the help!
Offline
Here's another one for those that are freaked out by coding like me. I just got a little lucky after looking at the previous posts and did a little tweaking, but they seem to work. If someone familiar with coding could dbl check these it would be great. Given that I have only been using MB for a few days and really don't understand the coding.
All thanks go to
rmagere
Moonbase
UllicPendragon
Single
$rreplace($replace($rreplace($replace($replace($if2(%albumartistsort%,%artistsort%),...,…),/,-),\\.\$,$noop(.))/$rreplace($replace(%album%,...,…),\\.\$,$noop(.))$if($if2(%originalyear%,%date%), [$left($if2(%originalyear%,%date%),4)])/$num(%tracknumber%,2) - $rreplace($replace($replace(%artist%,...,…),/,-),\\.\$,$noop(.)) - $replace(%title%,...,…),_,$noop(.)),[*|:"<>?],)
Multiple
$rreplace($replace($if($eq(%albumartist%,Various Artists),AAVV,$rreplace($replace($replace($if2(%albumartistsort%,%artistsort%),...,…),/,-),\\.\$,$noop(.)))/$rreplace($replace(%album%,...,…),\\.\$,$noop(.))$if($if2(%originalyear%,%date%), [$left($if2(%originalyear%,%date%),4)])/$num(%tracknumber%,2) - $rreplace($replace($replace(%artist%,...,…),/,-),\\.\$,$noop(.)) - $replace(%title%,...,…),_,$noop(.)),[*|:"<>?],)
Example
Single Output:
M:\Music\Beatles, The\Help! [1965]\07 - The Beatles - Ticket to Ride.mp3
Multiple Output:
M:\Music\AAVV\Explosive Doowops, Volume 4 [1999]\05 - The Fantasys - Why Oh Why.mp3
Features
Same as rmagere's post above only that the album folder does not contain the artist name.
ie... \%artist name%\%Album% - %Year%\%track% - %Artist% - %Title%
Thanks to everyone at MusicBrainz for a great program! I have been looking for a GREAT program like this forever.
Offline
hello, i need some nice support, because i'm not confirmed in managing of many tracks...cheese. i have now an external hdd and i am clean up my mp3 files, so i want to creating a database. i show just my structur, like its seems in the next life.one especially question? how do i manage my tracks which are in german language, they should to create in a master path "X:\MP3\~ Deutsche Musik (~ German Music)\......
Examples:
Artists = "X:\MP3\Album\Hard-Rock\A\AC-DC\1990\AC-DC_-_The_Razor's_Edge_(1990)-Hard-Rock-V5-\101-AC-DC_-_Thunderstruck.mp3"
Sampler = "X:\MP3\Sampler\~ VA\~ Boxset (if it used)\Funk\N\Nighttime_Lovers\2009\VA_-_Nighttime_Lovers_Collector's_Box_12CD's_2009)-Funk-V5-\CD11\
1113-Glass_-_Let_Me_Feel_Your_Heartbeat.mp3" (it is track number 135 und the last in this cd).
Playlists = "X:\Playlisten\2009\04-2009\Sampler\~ VA\N\Nighttime_Lovers\VA_-_Nighttime_Lovers_Collector's_Box_12CD's_2009)-Funk-V5-.m3u (included then all tracks)
is there some medicine for me ... **smile**
Offline
Hi monchichi, you may want to start a new topic for your questions as this topic is more for different naming strings that people are wanting to share rather than for troubleshooting issues, you will get more replies that way. Picard cannot yet handle things like German Music or Sampler as tags to use for naming and grouping music.
To do this would likely need a plugin or picard script and if you could set a tag such as Grouping to hold the info for German Music then you could use it for file naming.
Maybe scan files in different sessions, like do all your german music and set "Move tagged files to folder" X:\MP3\~ Deutsche Musik (~ German Music)\ and then tag your samples and change the destination to X:\MP3\Sampler\
Offline
mll wrote:
It may be a good idea to to some benchmark on how everyone uses the powerful file naming parameters of PicardQt.
Here are the ones I uses at the moment, I seem to be perfectly happy with them. For both, you'll need this plugin if you run Picard0.9.0Alpha9 or less.
Does this plugin avoid the truncation of song titles?
If not, how do I avoid song titles being truncated when I view them in Windows Media Player?
Offline
jonsonchong wrote:
Does this plugin avoid the truncation of song titles?
If not, how do I avoid song titles being truncated when I view them in Windows Media Player?
Offline
I am trying to retag some of my daughter's compilation CD-Rs that she made. So they have a bunch of different artists/album sources. When I retag them I'd like MusicBrainz to create a new artist folder (or use the existing), then a new album folder (or use the existing) and save the retagged file there.
Can I do that with the right string? Is there one already listed here?
Thanks,
John
EDIT:
I think I got it. I needed to check "move" files.
.
Last edited by jecottrell (2009-06-15 20:14:20)
Offline
I could need some good advice on an script i tried to "create". I took the one rmagere postet a little up here and mainly changed the running order, but Picard tells me, there would be some kind of error. The occuring error reads: "File naming format: Unexpected character '(' at position 247, line 1.
The preview should have shown: /Beatles, The/1962 - Help!/The Beatles - 07 - Ticket to ride.mp3
My script:
$rreplace($replace($rreplace($replace($replace($if2(%albumartistsort%,%artistsort%),...,…),/,-),\\.\$,$noop(.))/ [$left($if2(%originalyear%,%date%),4)]) - $rreplace($replace(%album%,...,…),\\.\$,$noop(.))$if($if2(%originalyear%,%date%)\$rreplace($replace($replace(%artist%,...,…),/,-),\\.\$,$noop(.)) - $num(%tracknumber%,2) - $replace(%title%,...,…),_,$noop(.)),[*|:"<>?],)
Does anyone find a problem, or can solve it with an other script?
Thanks, Simon
Offline
File Naming Format:
$set(issoundtrack,$if($eq(%releasetype%,soundtrack),1,0)) $set(artist,$if2(%albumartist%,%artist%)) $set(artist,$if($eq($left(%artist%,4),The ),$rreplace(%artist%,^The ,)\, The,%artist%)) $set(title,$replace(%title%,...,…)) $set(album,$replace(%album%,...,…)) $set(date,$left(%date%,4)) $set(albumdate,$if(%date%,%date%-%album%,%album%)) $set(tracknumber,$if(%tracknumber%,$if($eq(%tracknumber%,0),0,%tracknumber%),0)) $set(tracknumber,$if($eq(%tracknumber%,0),%tracknumber%,$if($eq($len(%tracknumber%),3),$num(%tracknumber%,3),$num(%tracknumber%,2)))) $set(tracktitle,$if($eq(%tracknumber%,0),%title%,%tracknumber%-%title%)) $if($eq(%issoundtrack%,1),OST/%album%/%tracknumber%-%artist%-%title%,%artist%/%albumdate%/%tracktitle%)
Multiple Artist file naming format:
$set(issoundtrack,$if($eq(%releasetype%,soundtrack),1,0)) $set(title,$replace(%title%,...,…)) $set(album,$replace(%album%,...,…)) $set(tracknumber,$if(%tracknumber%,$if($eq(%tracknumber%,0),0,%tracknumber%),0)) $set(tracknumber,$if($eq(%tracknumber%,0),%tracknumber%,$if($eq($len(%tracknumber%),3),$num(%tracknumber%,3),$num(%tracknumber%,2)))) $set(trackartisttitle,$if($eq(%tracknumber%,0),%artist%-%title%,%tracknumber%-%artist%-%title%)) $if($eq(%issoundtrack%,1),OST/%album%/%tracknumber%-%artist%-%title%,VA/%album%/%trackartisttitle%)
Preview Results
/media/drive/picard/Beatles, The/1965-Help!/07-Ticket to Ride.mp3
/media/drive/picard/VA/Explosive Doowops, Volume 4/05-The Fantasys-Why? Oh Why?.mp3
*This code is really easy to change
Last edited by wentuq (2009-11-19 21:18:41)
Offline
Looking to rename files to Artist Name - Album - Tracknumber 0 infront - track name
can anyone list that? thanks. I don't want the track number first. I want the artist name first.
Offline
daeros wrote:
Looking to rename files to Artist Name - Album - Tracknumber 0 infront - track name
can anyone list that? thanks. I don't want the track number first. I want the artist name first.
I guess by "Artist Name" you want the Album Artist not the track artist. If so, you can use:
%albumartist% - %album% - $num(%tracknumber%,2) - %title%
And I would suggest having track artist for multiple artist releases. Something like:
%albumartist% - %album% - $num(%tracknumber%,2) - %title% - %artist%
Last edited by ym (2009-08-02 10:42:06)
Offline
I use this to keep my files under the 42 max character limit for the FATX filesystem on my Xbox (I was using it as a standalone jukebox / media player)
$left($if2(%albumartist%,%artist%),42)/$left(%album%,42)/$num(%tracknumber%,2) $left(%title%,38)
Offline
Thx wentuq, your code looks greate. I tried to improve it a little bit, but failed.
I'd like to replace / in atrist or title with a blank:
$set(artist,$replace(%artist%,/, ))
But this code doesn't work. AC/DC is still named as AC_DC.
Can anyone help?
Offline
This is actually a full-length script I've used, not just a file-naming string. I can't guarantee that this example is perfect - it's a few weeks old and I've moved on since then, so there may be a couple of wonky bits to this one in some situations. It may be useful to some people starting out with scripting, since it illustrates syntax required for tagger scripts in lots of different situations; the script is roughly 40 lines long, and uses a large number of the tagger functions and several of the tag variables (as well as some custom variables).
First, the code itself:
$set(true,-1)
$set(false,0)
$set(IsMusicBrainz,%true%)
$set(SpecialReleaseType,%false%)
$if2(
$if($eq($len(%musicbrainz_albumid%),0),Music - No MBID$set(IsMusicBrainz,%false%)),
$if($eq(%releasetype%,live),Music - Live),
$if(
$or(
$or(
$eq(%releasetype%,spokenword),
$eq(%releasetype%,audiobook)
),
$eq(%releasetype%,interview)
),Spoken Word
),
$if($eq(%releasetype%,soundtrack),Music - Soundtrack),
$if($in(%album%,Promo Only), Music - Promo Only$set(IsMusicBrainz,%false%)),
$if(
$and(
$lt($matchedtracks(),%totaltracks%),
$lt($matchedtracks(),60)
),Music - Incomplete Releases),
Music$if(%releasetype%,$set(SpecialReleaseType,%true%))
)/
$if2(%albumartist%,%artist%)/
%album%
$if(%releasecountry%, - %releasecountry%)
$noop($if(%SpecialReleaseType%, - %releasetype%))
$if(%IsMusicBrainz%,
$set(_y_,$if2($left(%originaldate%,4),$left(%date%,4)))
$if($in(%album%,%_y_%),, - %_y_%)
)/
%tracknumber%
$if($ne(%artist%,%albumartist%), - %artist%)
- %title%I'll break this down and go through it below.
Before getting into that, let me point out something important that can be a barrier to understanding Picard's tagging. Picard reads the content of a tagger script and does the following:
- if it sees a line break or tab, it discards it. That lets you put things on multiple lines and indent them easily.
- if it sees something that is a known function - it looks like $<something>( ... ) - the code gets evaluated using the special function $<something>. If the function returns some value, that gets added to a string Picard is using to build the save path for the music file it's working with. There may be nothing returned from a function, however; $set() and $noop() won't return anything, and $if() and $if2() might not return a value.
- if it sees a variable (surrounded with % marks), Picard substitutes in the value of the variable and adds that to the string it's building. If the variable is empty, then nothing gets added.
- Text characters outside functions and variables are added literally. This lets you directly add spaces, words, or the "/" marks that identify folders.
Initial setup
I start out by setting up some things I'll use later:
$set(true,-1) $set(false,0) $set(IsMusicBrainz,%true%) $set(SpecialReleaseType,%false%)
This creates variables named %true% (with a value of -1), %false% (with a value of 0), %IsMusicBrainz% (with an initial value of %true%), and %SpecialReleaseType% with a value of %false%.
First step - setting the collection folder
The following $if2 block returns the first non-empty value from its list. What this does, in effect, is return a string that becomes a top-level folder for a media collection. I have the default output folder set to D:\Data in Picard, so each collection becomes a named folder under that.
$if2(
$if($eq($len(%musicbrainz_albumid%),0),Music - No MBID$set(IsMusicBrainz,%false%)),
$if($eq(%releasetype%,live),Music - Live),
$if(
$or(
$or(
$eq(%releasetype%,spokenword),
$eq(%releasetype%,audiobook)
),
$eq(%releasetype%,interview)
),Spoken Word
),
$if($eq(%releasetype%,soundtrack),Music - Soundtrack),
$if($in(%album%,Promo Only), Music - Promo Only$set(IsMusicBrainz,%false%)),
$if(
$and(
$lt($matchedtracks(),%totaltracks%),
$lt($matchedtracks(),60)
),Music - Incomplete Releases),
Music$if(%releasetype%,$set(SpecialReleaseType,%true%))
)/Here's a quick re-listing of each segment of the code, followed by the explanation about the collection folder that segment causes Picard to use.
$if($in(%album%,Promo Only), Music - Promo Only$set(IsMusicBrainz,%false%)),
If the album name includes 'Promo Only' (the name of a specialized DJ collection that is often not categorized in MusicBrainz), I set the collection to Music - Promo Only. We also set the IsMusicBrainz variable to false.
$if($eq($len(%musicbrainz_albumid%),0),Music - No MBID$set(IsMusicBrainz,%false%)),
This sets our collection folder to Music - No MBID; I use it for items that aren't recognized by MusicBrainz for whatever reason - either they're private or they're audio not yet listed that I don't have time to enter into MusicBrainz. It also sets the IsMusicBrainz value to false.
$if(
$and(
$lt($matchedtracks(),%totaltracks%),
$lt($matchedtracks(),60)
),Music - Incomplete Releases
),If we're missing some items from a release, we set the collection folder to Music - Incomplete Releases. Note that I use the undocumented $matchedtracks() function. This FAILS on clusters that haven't been identified since they don't have a proper musicbrainz album id used for track match counts. Note also that I only enforce redirection if the cluster has less than 60 tracks; this prevents misdirecting albums that have lots of silent tracks (which I don't retain).
$if($eq(%releasetype%,live),Music - Live),
Sets collection folder to Music - Live if the MusicBrainz releasetype is 'live'.
$if(
$or(
$or(
$eq(%releasetype%,spokenword),
$eq(%releasetype%,audiobook)
),
$eq(%releasetype%,interview)
),Spoken Word
),Sets the collection folder to Spoken Word if the releasetype is spokenword, audiobook, or interview. Since the $or function can only take 2 values from a script, I had to nest multiple $or functions to test all three conditions.
$if($eq(%releasetype%,soundtrack),Music - Soundtrack),
Sets the collection folder to Music - Soundtrack if the releasetype is soundtrack.
Music$if(%releasetype%,$set(SpecialReleaseType,%true%))
The final item is the word 'Music'; if nothing has been matched before this, our collection folder will be Music. I also set SpecialReleaseType to true if there IS a releasetype defined. I can use this later to tell me if the particular release does have a releasetype defined, but it isn't spokenword/live/audiobook/interview/soundtrack.
At the very end of the section, we have
/
by itself, so whatever value Picard pulled from the $if2 function becomes a folder.
Selecting the artist folder
This is pretty simple. I use the ReleaseArtist (%albumartist%) as the artist folder for everything; if there is no albumartist defined in the ID3 tags, then this defaults to %artist%. It's then followed by a terminal / mark to make sure this becomes a folder, like this:
$if2(%albumartist%,%artist%)/
Setting up release folder
To prevent name collisions or accidental mixups among distinct releases that have the same names, I try to ensure that all releases are in distinct folders. This means I need more than just the album name as a folder. The following is my basic code for doing the entire folder:
%album%
$if(%releasecountry%, - %releasecountry%)
$noop($if(%SpecialReleaseType%, - %releasetype%))
$if(%IsMusicBrainz%,
$set(_y_,$if2($left(%originaldate%,4),$left(%date%,4)))
$if($in(%album%,%_y_%),, - %_y_%)
)/I start with the album name (%album%).
Then, if there is a release country, I add " - %releasecountry%"
Although current disabled using $noop( .. ), I can also add releasetype easily with $if(%SpecialReleaseType%, - %releasetype%). This lets me automatically add ep/album/compilation/remix/single if I need it to disambiguate (for example, a single and an album released with the same name in the same year in the same country).
The last part is to add a date. This is a bit complicated.
First, I don't want to add a date for albums that aren't in the MusicBrainz database, since they may be ad-hoc collections that have different year tags, so I only run the code for adding the date if %IsMusicBrainz% which I set earlier is still true. If so, then I get the date, but I want to do it a particular way to ensure that I DO get possible collisions when duplicating data. I want to select the original date for the album rather than a particular release date if at all possible. Since MusicBrainz returns dates in the form yyyymmdd, I just get the first 4 numbers in %originaldate% if it exists, and use %date% (the release date) if not. I then put this value into the variable %_y_%.
The reason I do this is to handle a couple of peculiar cases that I find irritating.
First of all, I want to have find out whether the release year I have shows up in the album name. If so, I don't want to use the year in the album name; otherwise, I'll get things like this:
Baz Hits of Summer 2005 (disc 1) - GW - 2005
so I actually test to see if %_y_% is in the album name. If it is, I do nothing. If it isn't I go ahead and add " - %_y_%" to the release folder name I'm building, and end with the / that turns it into a folder.
Naming the file
The last step is naming the music file. This has 3 parts, on 3 lines for clarity:
%tracknumber% $if($ne(%artist%,%albumartist%), - %artist%) - %title%
The %tracknumber% simply begins the file name with the track number.
The next line checks to see whether the artist is the same as the album artist. If and only if it isn't, then " - <artist>" gets added to the file name.
Finally, we add " - " and the title to the end.
Offline