This should add the disc number only if there are multiple discs in the release. If you want the disc number to be always shown, change $if($gt(%totaldiscs%,1),%discnumber%-) to simply %discnumber%- instread.
Thanks Bob, I think we’re almost there! The only issue now is that the Artists are still being assigned the initial ‘letter’ folder by their last name, while the artist folder itself is now how I want it. Is there a way to reverse this, so the Artist folder is assigned the first character of the first name? e.g. David Bowie is displayed as David Bowie, but is under the B folder, whereas ideally I’d like him to be under the D folder. Is that possible?
I certainly will. Is there any way to incorporate the element of trimming album and track names which your script does to the one you’ve suggested for myself? I have a few albums where the titles and tracks are too long to be useful. Is it simply a case of copying lines 323 and 324 to the start of my script?
There is, but it’s not quite as simple as copying those two lines. The revised script to incorporate this is:
$noop(
########################################################################
# #
# User Settings: #
# #
# _aTitleMaxLength - Maximum length of album title in file name #
# _tTitleMaxLength - Maximum length of track title in file name #
# _tFilenameMaxLength - Overall maximum length of track file name #
# #
########################################################################
)
$set(_aTitleMaxLength,65)
$set(_tTitleMaxLength,65)
$set(_tFilenameMaxLength,120)
$set(_nANT,%album%)
$set(_nTNT,%title%)
$if($gt($len(%_nANT%),%_aTitleMaxLength%),$set(_nANT,$left(%_nANT%,$sub(%_aTitleMaxLength%,3))...))
$if($gt($len(%_nTNT%),%_tTitleMaxLength%),$set(_nTNT,$left(%_nTNT%,$sub(%_tTitleMaxLength%,3))...))
$set(_nFN,$if($gt(%totaldiscs%,1),%discnumber%-)$pad(%tracknumber%,2,0) %artist% - %_nTNT%)
$if($gt($len(%_nFN%),%_tFilenameMaxLength%),$set(_nFN,$left(%_nFN%,$sub(%_tFilenameMaxLength%,3))...))
$upper($firstalphachar($swapprefix(%_artists_album_primary_std%)))/
$swapprefix(%_artists_album_primary_std%)/
[$left($if2(%originaldate%,%originalyear%,%date%,0000),4)] %_nANT%/
%_nFN%
Is there anything else? If so, please try to think of all changes so that we don’t keep updating and posting a new script for each individual change. Thanks.
Again many thanks to you @rdswift for your clean script. The tilde for the directory structure was nice thinking. I tried changing it to other characters or with none at all to see if I prefer something else but the tilde works well.
I recently decided to take the plunge and start using Picard for cleaning up my library. So much faster and easier (especially with your script!). Since I was using another tagger program my collection has a lot of unofficial tags. I’m trying to remove them but one that I used “ripping tool” was to identify the use of EAC to rip the FLAC. I would like to copy the value of the “ripping tool” tag and copy it to “%encodedby%” iff it has “Secure” in the value. I created the following script and tried it in the tagger script but then read that encodedby is only available in the renaming script. Either way it doesn’t seem to be working for me and not sure how to see what its doing/not doing. Should it be in a tagger script or in fact in the rename script? If the latter, where exacty? I would think since it’s just altering tags it could be anywhere pretty much.
For example: %ripping tool% = “EAC Secure” → copy “Exact Audio Copy (Secure Mode)” to %encodedby% then delete the ripping tool tag. If it doesn’t find “Secure” then it just lets Picard clear existing tags with the option setting. I got some ideas from this thread (thanks @hiccup) so hopefully I’m not far off. Can I get some help with this? Maybe my understanding of the Picard order of operations isn’t correct and I’m clearing what I’m setting.
Just to confirm, if you’re wanting to update a tag to be written to the file, it needs to be done in a tagging script (and not in the file naming script). Tag assignments made in a file naming script will not be written to the tags in the file.
As for the script you showed, I think you’re very close to having it do what you want. The one fatal thing is that you’re using $copy() when I think you should be using $set() instead. The $copy() command expects both arguments to be tag (or variable) names and not actual content. Also, I would have used $in() rather than $find() but I think you’re probably okay in this case.
Try something like the following (your script with a couple of tiny changes) and see if it does what you want:
In addition to using $set() instead of $copy(), you’ll note that I removed the $get() from the $delete() command. When you use $delete() the argument is the tag name to delete, rather than the content of the tag. The only thing I’m not sure about without testing, is if the $delete() will work with the tag name containing a space, but I think it should work.
I hope this helps, and that it works for you. Good luck with it.
EDIT: One other thing that I just thought of… Since the “ripping tool” tag is in the existing files and not in the information being downloaded from MusicBrainz, you may need to run this script manually once you have matched the files to tracks in the right-hand pane. To do this, right click the album in the right-hand pane and select your script from the dropdown list in the “Run scripts” command in the context menu. Depending on what other scripts you have enabled, you mave have to select the files and run the script in the clustering pane before matching them to tracks in the album pane. In fact, I think this is the process that I would use (running the script against the files in the cluster pane), because I think it might be safer. I suggest experimenting with a copy of a few files first to see what works best for you.
Thanks so much @rdswift! Your changes worked perfectly!
I changed $find() to $in() as it’s better programming. Thank you for clarifying the difference between $copy() and $set() and that I had some cleanup to do from some changes I made while playing around. I originally had two tags but wouldn’t have noticed that difference. I think that was the culprit. The $delete() worked just fine with the space in the tag name. I need to test your EDIT comment still. The test files I was using are automatically moved to the “looked up” right pane but the manual script worked running from there as well. I don’t have anymore scripts aside from these two for now but will keep it mind to run in the “cluster” pane.
I saw this getting answered above me, but I can’t figure out how to get it to work unfortunately
I’m using the simple script
%artist%/%date%/%album%/%artist% - %title%
but any artist featured with the main artist ends up with its own folder, and I just want them all in the same album folder.
I installed the additional artist variables plugin, but I just can’t figure out how to get it working. Would someone be able to give me some help please