Help for adjusting renaming script

I’ve scrolled through this thread and honestly not sure where to start. However, your script on GitHub is likely where I need to be. I would appreciate any help from you or other contributors. I will try to keep this short. I’m cleaning up a very large digital collection.

The basic file name … 01 - Song Title … is my starting point.

Additional information from tags I am considering:

  • SACD or similar descriptive
  • Inserting Special Comments … 01 - Song Title - [ICON] … to separate very special artists. Examples - Elvis, Stevie Wonder, Etta James, The Beatles. Yes most will be easy to identify.
  • Add Genre to title … 01 - Song Title - [Rock]

Is there a way to sort the renamed file not just by the artist, but also the Genre? Or is the only option to put the Genre onto the Artist … for example "Cash, Johnny [Country] … I prefer to group by Genre and Artist. I realize Media Center will do that and perhaps it is redundant to do it with actual files.

If “Rock” the file would be moved to … M:\Music\Rock\A\Artist\Album\Track01

I want to automate as much of this renaming and sorting as possible.

I hope you and others don’t mind an idiot newbie question. Because of some health issues I now have difficulty with things that use to be so simple for me. I’m frustrated because the basics of scripts, taggers and other things in Picard is making my head spin a bit. It should still be easy and it’s not. Because of that I will ask for someone to please point me in the right direction.

  • Where do I find the tagger scripts?
  • Is there one or several that most feel are must use scripts?
  • I now realize there are multiple renaming scripts, is there an easy way to see sample out put from the more popular ones?
  • What are the actual steps for loading and saving the scripts?

I hate that I am having to ask such basic questions. I’m off to read more of the user guide.

Thanks to anyone who answers and for all who have shared their scripts already. Now if I can just get this to make sense.

First off, sorry for not responding sooner. I hope that I didn’t leave the impression that I was ignoring you.

Just to clarify, is this how your files are currently named, or is this your starting point for the new file naming? I assume the latter.

This should be available from the %media% tag.

In order to automate this, the script will need to know which artists are considered “very special”. You will need to prepare and maintain a list.

This information may be available from the %genre% tag; however, the genres assigned vary widely according to personal taste. The ideal case would be if you already had a genre tag assigned in the metadata of each file, containing your preferred genre for the track. This could be used if it was available, otherwise falling back to the value provided by MusicBrainz.

I believe that genre is a track attribute, rather than an artist attribute. For example, an artist may very well produce music of different genres, sometimes even on the same album. My favorite example of this is the track “Hot Dog” (clearly “country music”) on the Led Zeppelin album “In Through the Out Door”.

You could have Picard automatically organize your files as you’ve shown, but be aware that this would result in an album being split up if one (or more) track on the album was assigned a different genre from the rest. A preferred approach might be to have a series of tagging scripts (one for each genre that you want to use) that you would run manually to set the genre for a whole album before you saved it. This value could be saved as a tag within each file so that it you would only have to enter it once, and it would be reused if you ever re-tagged the file / album. @Billy_Yank has provided an example of how this is done in his scripts

Tagging scripts are found in the. Scripting section of Picard’s configuration options settings.

From my perspective, not really. The scripts used are specific to the requirements of each individual user.

Picard will only allow one file naming script at a time. Unless the script author has included an example of the output in the script documentation (or as a comment in the script itself), the only other (easy) way that I know is to copy the script as the naming script in Picard and see what the examples look like, that Picard includes at the bottom of the File Naming options screen.

The tagging scripts are entered in the Scripting section, and the file naming script is entered in the File Naming section of the option settings. Have a look at the Scripting and Scripts sections of the documentation for a bit more information regarding the different types of scripts. You might also want to have a look at the Writing a File Naming Script tutorial.


First thank you for the reply. I didn’t feel like you were ignoring me at all. I have spent some time reading through this thread. Yes, a few sections multiple Times. I appreciate the thought responses you have given. I did start to figure out parts of this.

The file naming that I mentioned is present in roughly 80% of my files. However, that still leaves a large amount to rename. Fortunately that same group I’ve tagged the majority of the files already. So implementing the “Genre” would not be completely out.

I should have mentioned that for Genre I was expecting the error possibilities you mentioned. While I have tagged most there would be tracks I missed. I think I will use the work around that I have. I use media center from J River. I can grab an artist and tag all the albums by an artist at once. Your example of Hot Dog is so perfect … I love that song and yes it is definitely not rock.

I was already rethinking the genre, but I can tag large all tracks by an artist fairly quickly in J River Media Center. If I tagged … all of Led Zeppelin as Classic Rock. I could then run the output through an if sort. I have thought out a couple ways to do this. I will look at this a bit further. My thought was pulling the genre from a tract and using that to direct to the save location. Honestly I think you just convinced me that my original idea wouldn’t work, creating more problems then it solved. I was already leaning this way since reading and understanding Picard better. Sort as you do, and let J River, pull the genre - which is it’s job anyway.

I may yet come back with some questions. I’m amazed at the level of details you and Billy have helped people get out of their files. Personally I am not looking to know the BPM or other fine details. Give me the artist, album, tract # & title … sort it all into new clean output, organized in the simplistic 27 folders … and yeah I will be pretty darn good.

Your answers helped me confirm somethings I thought I was understanding and clarified a few that were still fuzzy. Thank you.

1 Like

One question I should have asked.

When I run some of the scripts there are things I might want to eliminate. Can I block it with “Snoop” code or how would I stop it from being included? Is the only way to delete the code completely?

For example one script I tested added a sub folder that was information on the tracks …

Artist …
… Album Type
…Title / Date / Release Type / Label / Code (likely the Picard number)
… Album Title / File Type
… Disc 1, Disc 2

I’m a simple guy when it comes to organization … K.I.S.S. … problaby doesn’t make sense since I have mentioned possibly sorting by Genre, but that is more a matter of storge space (Rock and Country each reside on drives dedicated to the Genre - I used the artist main body of work to define where they are stored.

I don’t know that I will ever want some of the details that others love to have. Best practice to remove the unwanted details?

You can either remove the unwanted code from the script, or you can wrap it inside a $noop() function. Both should work.

1 Like

Poking around I found out there is an Artist Genre. I’m not sure how Picard handles it. I wonder if there is a way to call it up and apply it to the save. Personally, I don’t need 3, 5, 1- Genres per track.

Here is screen shot where I learned that there is artist genre. Being able to sort by genre would be very helpful due to the storage. I prefer to keep all Rock on one drive, Country is on another, and everything else goes on a third drive. Cleaning up what I have is important and in order to take advantage of the renaming script requires allowing move.

Also, is there a simple way with your script to have artists sorted by first letter of first name?
Reba McEntire would go under R\Reba McEntire\Album Name\track # - track

Same with sorting “The Rolling Stones” to “Rolling Stones, The”

Thanks for your help!

I have split this topic as I think it is best to keep long discussions out of the “repository of useful scripts” thread.

Regarding artist genre: Currently it can only be used as a fallback in case there are no genres defined on a lower level ( release or recording). I think we have a feature request somewhere to allow the artist or release genre being used exclusively.


Thanks for the clarification. I will try to remain more on point in the future as well.

1 Like

I haven’t tested this, but I think if you change line 133 from:




that should do what you want.


It works perfectly.

I think we need to start paying you!

Thank you!

1 Like

Knowing that I’ve been able to help in some small way is payment enough. The real thanks go to the people that develop and maintain Picard itself.


They definitely deserve our thanks and $upport.

As do people like you who are willing to help others and not laugh at silly nu-be questions.

Give me a photography or woodworking question and I can probably help. I use to be able to code a little bit, but the brain just doesn’t fire as well with the meds. I’m trying to better understand this but still not quite pulling it together. You have been very helpful.

Questins related to the Genre idea:

Would it be possible to right a script that would strip out all the genre tags - which I then use the “artist genre” default. This would then allow me to get everything sorted to the directories I want. From there I could go back and tag genres if I wanted. I’m see a few tags that frankly I don’t want / need.

Example of that was a Reba McEntire song that had tags like this … "Love, country, REBA, pop, country-pop … " and more.

I personally would like to see the genre tags become … "Artist Genre (so any Reba track would get Country), then all the other tags. Hound Dog by Led Zeppelin would start with “Rock”

I will admit to not being concerned with the minute details of genre.

Related to genre tags, would it be possible in a script to tell it to only pull the first value and ignore the rest? At least than hand sorting the files would be a bit easier.

I’m probably in the minority where I don’t want all these different genre tags, simply because it gets things so cluttered. Especially because if somehow a song doesn’t have a related tag … a Reba song not tagged Country than it wouldn’t be pulled up by JRiver Media Center when I chose to play “Country”

No rush on any of this, I am amazed at how fast you respond, but I never want you to feel like it is immediate need. It took awhile to get things messed up on my end and will take time to sort through :smiley:

1 Like

I’ve just updated my Additional Artists Variables plugin to expose a new scripting variable called _artists_album_primary_tags, which is a multi-value variable that lists the top 5 tags for the primary album artist on a release. For Reba McEntire, there is currently only one tag (country) assigned, so the value of the _artists_album_primary_tags variable would be “country”. On the other hand, the value returned for Led Zeppelin (as of the time of this message) would be “hard rock; rock; blues rock; british; classic rock”.

To get just the first item, you would do something like:


Until the new version is available in the list of official plugins, you can download it from GitHub.

I would appreciate any comments, suggestions, feedback if anyone wants to give this a try – especially if you find a bug. :wink:

1 Like

I will take a look shortly. Once again you are ahead of the curve. I have come across a couple of things, but I suspect it is the tags on the files. Not on this part but on your naming.

Some albums are being put into directory … Music\issues (correct part of sort) … then \Soundtracks

Example … Soundtracks\ [1967] Magical Mystery Tour

I was surprised that it put that in Soundtracks and not with other Beatles albums. I checked the tags and in Music Brainz and it is marked as Album + Soundtrack … shouldn’t it have been under The Beatles as a soundtrack album? I may have misunderstood how the soundtracks, compilations and other album types are sorted

It’s just a difference in the way I sort my soundtrack albums. The script currently sorts all soundtracks into a separate “Soundtracks” directory. To have it do what you want, you’ll have to change the directory template for soundtracks (around line 310 of the script) from:

$if($eq(%_nAlbumType%,Soundtrack),$set(_nFilePath,%_cSoundtrack%/%_nYear% %_nANT%/))

to something like:

$if($eq(%_nAlbumType%,Soundtrack),$set(_nFilePath,%_nInitial%/%_nFAAPS%/%_cSoundtrack%/%_nYear% %_nANT%/))

Note that I haven’t tested the code above.

1 Like

Your sort order might be a better way to do it. Clearly you’ve put a lot of thought into it all. Again thank you for your amazingly quick response and solution. I will try out this fix and the one with the 5 tags. I will report back later.

Not so much thought as you might believe. :wink:

The really nice thing about using Picard to do all the tagging and renaming is that if you change your mind about something, all you have to do is make the changes to the naming script and re-process the impacted files. If you’ve allowed Picard to save the release information to the files (which it does by default), you don’t even have to do the lookup / cluster part of the process. Quick and easy. Another thing that was well thought out by the developers.

1 Like

I checked out the code you posted to move the soundtrack to the artist and it worked perfectly.

Will that move any compilation soundtracks to Various, or will it potentially move each track of a compilation sound track to the track artist?

The soundtracks will be moved to whoever is listed as the primary (first) album artist. In some cases, that will be Various Artists. In no cases will the soundtrack album be split to the different track artists.

1 Like