Hola,
So, I don’t understand the script coding language too well, my knowledge basically consisted of %artist% and %album%. So I dug through the forums to find a script someone else wrote that would give me something close to what I want, and then tweaked it to my needs.
Well, I’ve reached the limit on what I know how to change. My problem with the current script is some of the character replacement - I actually don’t have a huge issue with forbidden and nonlatin characters and the like, and I prefer to have my filenames with proper Japanese characters, tags with the same, etc. Of course, I understand that certain things like colons simply will never be in file names, but they can still make it into tags and that’s fine with me. The trouble is, I can’t really figure out exactly how I need to tweak this beastly script to allow those conventions in filenames (and the others at least in metadata). If someone would kindly lend assistance, I’d be very grateful…here’s the script:
$noop(Variables for characters replacement and maximum filename length)
$set(_unixforbiddencharactersfullstop,.)
$set(_unixforbiddencharactersonedotleader,․)
$set(_unixforbiddencharactersellipsis,...)
$set(_unixforbiddencharactershorizontalellipsis,…)
$set(_windowsforbiddencharacters,\\/:*?"<>| \\n)
$set(_musicbrainzreplacementforwindowsforbiddencharacters,)
$set(_charactersforspace,\\s)
$set(_maximumlength,85)
$set(_toolongmarker,[…])
$noop(Variables for flags you can write in the comments of the musical file)
$noop(Attention: Do not write parentheses in the Comment tag)
$set(_artistdelimiter,;)
$set(_commentdelimiter,|)
$set(_nonlatinartistinenglish,NonLatinArtistInEnglish=)
$set(_nonlatinartistinlatin,NonLatinArtistInLatin=)
$set(_artistcommentinenglish,ArtistCommentInEnglish=)
$set(_nonlatinalbuminenglish,NonLatinAlbumInEnglish=)
$set(_nonlatinalbuminlatin,NonLatinAlbumInLatin=)
$set(_albumcommentinenglish,AlbumCommentInEnglish=)
$set(_nonlatintitleinenglish,NonLatinTitleInEnglish=)
$set(_nonlatintitleinlatin,NonLatinTitleInLatin=)
$set(_titlecommentinenglish,TitleCommentInEnglish=)
$set(_firstpartofthename,FirstPartOfTheName=)
$set(_lastpartofthename,LastPartOfTheName=)
$set(_samemainartistforalltracks,SameMainArtistForAllTracks=)
$noop(Part 1: Define artist part)
$noop(1 - Extract form Comment tag the flags about non-latin artist in english, otherwise in latin)
$set(_nonlatinartist,$rsearch(%comment:%,%_nonlatinartistinenglish%[^\(\)]+))
$if($eq(%_nonlatinartist%,),$set(_nonlatinartist,$rsearch(%comment:%,%_nonlatinartistinlatin%[^\(\)]+)),)
$set(_nonlatinartist,$rsearch(%_nonlatinartist%,[^%_commentdelimiter%]+%_commentdelimiter%))
$set(_nonlatinartist,$rreplace(%_nonlatinartist%,^%_nonlatinartistinenglish%{1},))
$set(_nonlatinartist,$rreplace(%_nonlatinartist%,^%_nonlatinartistinlatin%{1},))
$noop(2 - Delete the delimiter which separe the different comments)
$if($eq($right(%_nonlatinartist%,1),%_commentdelimiter%),$set(_nonlatinartist,$trim(%_nonlatinartist%,%_commentdelimiter%)),)
$if($eq($right(%_nonlatinartist%,1),%_musicbrainzreplacementforwindowsforbiddencharacters%),$set(_nonlatinartist,$trim(%_nonlatinartist%,%_musicbrainzreplacementforwindowsforbiddencharacters%)),)
$noop(3 - Exactly the same but with the comments on the artist)
$set(_artistcomment,$rsearch(%comment:%,%_artistcommentinenglish%[^\(\)]+))
$set(_artistcomment,$rsearch(%_artistcomment%,[^%_commentdelimiter%]+%_commentdelimiter%))
$set(_artistcomment,$rreplace(%_artistcomment%,^%_artistcommentinenglish%{1},))
$if($eq($right(%_artistcomment%,1),%_commentdelimiter%),$set(_artistcomment,$trim(%_artistcomment%,%_commentdelimiter%)),)
$if($eq($right(%_artistcomment%,1),%_musicbrainzreplacementforwindowsforbiddencharacters%),$set(_artistcomment,$trim(%_artistcomment%,%_musicbrainzreplacementforwindowsforbiddencharacters%)),)
$noop(Part 2: Define album part, exactly the same)
$set(_nonlatinalbum,$rsearch(%comment:%,%_nonlatinalbuminenglish%[^\(\)]+))
$if($eq(%_nonlatinalbum%,),$set(_nonlatinalbum,$rsearch(%comment:%,%_nonlatinalbuminlatin%[^\(\)]+)),)
$set(_nonlatinalbum,$rsearch(%_nonlatinalbum%,[^%_commentdelimiter%]+%_commentdelimiter%))
$set(_nonlatinalbum,$rreplace(%_nonlatinalbum%,^%_nonlatinalbuminenglish%{1},))
$set(_nonlatinalbum,$rreplace(%_nonlatinalbum%,^%_nonlatinalbuminlatin%{1},))
$if($eq($right(%_nonlatinalbum%,1),%_commentdelimiter%),$set(_nonlatinalbum,$trim(%_nonlatinalbum%,%_commentdelimiter%)),)
$if($eq($right(%_nonlatinalbum%,1),%_musicbrainzreplacementforwindowsforbiddencharacters%),$set(_nonlatinalbum,$trim(%_nonlatinalbum%,%_musicbrainzreplacementforwindowsforbiddencharacters%)),)
$set(_albumcomment,$rsearch(%comment:%,%_albumcommentinenglish%[^\(\)]+))
$set(_albumcomment,$rsearch(%_albumcomment%,[^%_commentdelimiter%]+%_commentdelimiter%))
$set(_albumcomment,$rreplace(%_albumcomment%,^%_albumcommentinenglish%{1},))
$if($eq($right(%_albumcomment%,1),%_commentdelimiter%),$set(_albumcomment,$trim(%_albumcomment%,%_commentdelimiter%)),)
$if($eq($right(%_albumcomment%,1),%_musicbrainzreplacementforwindowsforbiddencharacters%),$set(_albumcomment,$trim(%_albumcomment%,%_musicbrainzreplacementforwindowsforbiddencharacters%)),)
$noop(Part 3: Define Title part, exactly the same)
$set(_nonlatintitle,$rsearch(%comment:%,%_nonlatintitleinenglish%[^\(\)]+))
$if($eq(%_nonlatintitle%,),$set(_nonlatintitle,$rsearch(%comment:%,%_nonlatintitleinlatin%[^\(\)]+)),)
$set(_nonlatintitle,$rsearch(%_nonlatintitle%,[^%_commentdelimiter%]+%_commentdelimiter%))
$set(_nonlatintitle,$rreplace(%_nonlatintitle%,^%_nonlatintitleinenglish%{1},))
$set(_nonlatintitle,$rreplace(%_nonlatintitle%,^%_nonlatintitleinlatin%{1},))
$if($eq($right(%_nonlatintitle%,1),%_commentdelimiter%),$set(_nonlatintitle,$trim(%_nonlatintitle%,%_commentdelimiter%)),)
$if($eq($right(%_nonlatintitle%,1),%_musicbrainzreplacementforwindowsforbiddencharacters%),$set(_nonlatintitle,$trim(%_nonlatintitle%,%_musicbrainzreplacementforwindowsforbiddencharacters%)),)
$set(_titlecomment,$rsearch(%comment:%,%_titlecommentinenglish%[^\(\)]+))
$set(_titlecomment,$rsearch(%_titlecomment%,[^%_commentdelimiter%]+%_commentdelimiter%))
$set(_titlecomment,$rreplace(%_titlecomment%,^%_titlecommentinenglish%{1},))
$if($eq($right(%_titlecomment%,1),%_commentdelimiter%),$set(_titlecomment,$trim(%_titlecomment%,%_commentdelimiter%)),)
$if($eq($right(%_titlecomment%,1),%_musicbrainzreplacementforwindowsforbiddencharacters%),$set(_titlecomment,$trim(%_titlecomment%,%_musicbrainzreplacementforwindowsforbiddencharacters%)),)
$noop(Part 4: Prefer %albumartist% on %artist%, but not if it is "various artists")
$noop(If there are many artist separated by ; we take just the first)
$set(_artist,$if($and($ne(%albumartist%,),$ne($lower(%albumartist%),various artists)),%albumartist%,%artist%))
$if($in(%_artist%,%_artistdelimiter%),$set(_morethanoneartist,1),$set(_morethanoneartist,0))
$if($eq(%_morethanoneartist%,1),$set(_artist,$rsearch(%_artist%,[^%_artistdelimiter%]+%_artistdelimiter%)),)
$if($eq(%_morethanoneartist%,1),$if($eq($right(%_artist%,1),%_artistdelimiter%),$set(_artist,$trim(%_artist%,%_artistdelimiter%)),),)
$noop(We add the parts about non latin artist and comments)
$set(_artist,%_artist%$if($ne(%_nonlatinartist%,), \(%_nonlatinartist%\),)$if($ne(%_artistcomment%,), \(%_artistcomment%\),))
$noop(Part 5: Define the date, if incomplete, we take just the year, otherwise the complete date)
$set(_date,$if2(%originaldate%,%date%))
$if($eq($len(%_date%),10),$set(_date,$left(%_date%,4)))
$noop(Part 6: If more than one disc, we write in the name the disc number and the subtitle of the disc)
$set(_album,%album%$if($gt(%totaldiscs%,1), \(Disc %discnumber%$if($ne(%discsubtitle%,), - %discsubtitle%\),\)$if($ne(%_nonlatinalbum%,), \(%_nonlatinalbum%\),)$if($ne(%_albumcomment%,), \(%_albumcomment%\),)),$if($ne(%_nonlatinalbum%,), \(%_nonlatinalbum%\),)$if($ne(%_albumcomment%,), \(%_albumcomment%\),)))
$noop(Part 7: If this is not a track, we write 0)
$set(_notrack,$if($if2($eq(%album%,[non-album tracks]),$eq(%tracknumber%,0),$eq(%tracknumber%,)),1,0))
$set(_tracknumber,$if($eq(%_notrack%,0),$num(%tracknumber%,1),0))
$noop(Part 8: Setting title)
$set(_title,%title%$if($ne(%_nonlatintitle%,), \(%_nonlatintitle%\),)$if($ne(%_titlecomment%,), \(%_titlecomment%\),))
$noop(Part 9: Exactly the same of the first paragraphs of this script: extract from the comments the part to write at the start or the end of the filename)
$set(_filenameprefix,$rsearch(%comment:%,%_firstpartofthename%[^\(\)]+))
$set(_filenameprefix,$rsearch(%_filenameprefix%,[^%_commentdelimiter%]+%_commentdelimiter%))
$set(_filenameprefix,$rreplace(%_filenameprefix%,^%_firstpartofthename%{1},))
$if($eq($right(%_filenameprefix%,1),%_commentdelimiter%),$set(_filenameprefix,$trim(%_filenameprefix%,%_commentdelimiter%)),)
$if($eq($right(%_filenameprefix%,1),%_musicbrainzreplacementforwindowsforbiddencharacters%),$set(_filenameprefix,$trim(%_filenameprefix%,%_musicbrainzreplacementforwindowsforbiddencharacters%)),)
$set(_filenamesuffix,$rsearch(%comment:%,%_lastpartofthename%[^\(\)]+))
$set(_filenamesuffix,$rsearch(%_filenamesuffix%,[^%_commentdelimiter%]+%_commentdelimiter%))
$set(_filenamesuffix,$rreplace(%_filenamesuffix%,^%_lastpartofthename%{1},))
$if($eq($right(%_filenamesuffix%,1),%_commentdelimiter%),$set(_filenamesuffix,$trim(%_filenamesuffix%,%_commentdelimiter%)),)
$if($eq($right(%_filenamesuffix%,1),%_musicbrainzreplacementforwindowsforbiddencharacters%),$set(_filenamesuffix,$trim(%_filenamesuffix%,%_musicbrainzreplacementforwindowsforbiddencharacters%)),)
$noop(Part 10: Control the size of the different parts to be sure that the filename won't be too long, otherwise, trunk the name correctly)
$if($gte($len(%_artist%),%_maximumlength%),$set(_artist,$firstwords(%_artist%,%_maximumlength%)%_toolongmarker%),)
$if($gte($len(%_album%),%_maximumlength%),$set(_album,$firstwords(%_album%,%_maximumlength%)%_toolongmarker%),)
$if($gte($len(%_title%),%_maximumlength%),$set(_title,$firstwords(%_title%,%_maximumlength%)%_toolongmarker%),)
$noop(Part 11: Center of the script, define the order of the parts)
$noop(If normal: Artist - Date - Album - Track - Title, If various artists: Album - Date - Track - artist - Title)
$noop(Possibility to force the order you wish with the flag SameMainArtistForAllTracks=1 or 2)
$if($eq(%compilation%,1),$set(_sameartistinthealbum,0),$set(_sameartistinthealbum,1))
$set(_forcesameartist,$rsearch(%comment:%,%_samemainartistforalltracks%[^\(\)]+))
$set(_forcesameartist,$rsearch(%_forcesameartist%,[^%_commentdelimiter%]+%_commentdelimiter%))
$set(_forcesameartist,$rreplace(%_forcesameartist%,^%_samemainartistforalltracks%{1},))
$if($eq($right(%_forcesameartist%,1),%_commentdelimiter%),$set(_forcesameartist,$trim(%_forcesameartist%,%_commentdelimiter%)),)
$if($eq($right(%_forcesameartist%,1),%_musicbrainzreplacementforwindowsforbiddencharacters%),$set(_forcesameartist,$trim(%_forcesameartist%,%_musicbrainzreplacementforwindowsforbiddencharacters%)),)
$if($eq(%_forcesameartist%,1),$set(_sameartistinthealbum,1),)
$if($eq(%_forcesameartist%,2),$set(_sameartistinthealbum,0),)
$set(_trackname,$if($ne(%_filenameprefix%,),%_filenameprefix% - ,)$if($eq(%_sameartistinthealbum%,1),%_artist%/%_album%/ %_artist% - %_album% - %_date% - %_tracknumber% - %_title%,%_artist%/%_album%/%_artist% -%_album% - %_date% - %_tracknumber% - %_title%)$if($ne(%_filenamesuffix%,), - %_filenamesuffix%,))
%_trackname%
I had to wrap it in code tags because the instructions in the sticky about formatting taggerscipt are…less than helpful. It formatted the first line of the script correctly, at least… I’m assuming the graves are a placeholder for spaces, which is what I did, but only 1 line gets formatted, probably due to how my script is formatted on its own.
Anyways, thanks in advance!
Kyle