Help for adjusting renaming script

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.

3 Likes

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:

$set(album_artist_genre,$if2($getmulti(%_artists_album_primary_tags%,0),unknown))

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

I downloaded the file from github, but I do not see a section / line that mentiongs _artists_album_primary_tags when I look at it in notepad.

Also, the part …
$set(album_artist_genre,$if2($getmulti(%_artists_album_primary_tags%,0),unknown))

do I need to add this somewhere or is it in the update file?

The file from GitHub is a plugin, not a script. You will have to install it in the plugins section of the Picard options. The line:

destination_metadata['~artists_{0}_primary_tags'.format(source_type,)] = tag_list

is where the new variable is created.

The script line that I mentioned:

$set(album_artist_genre,$if2($getmulti(%_artists_album_primary_tags%,0),unknown))

will extract the first genre tag associated with the album artist, and save it in a tag called album_artist_genre. From there you can add it to the appropriate spot in your file naming script, in your case to place the genre at the start of the output path.

1 Like

Should this have pulled the artist genre and used it rather than what is in the DB or only if there was nothing in the DB?

I got the same genre tags as before. Something isnt working quite right in the regular setup as I chose to only pull one item for genre. Despite that setting it is still returning multiple genre tags. I am going to try running a few more tests, see if I need to change up a setting or two.

I updated the plugin this afternoon. It now honors the “Maximum number of genres” setting, but even with the prior version the script line:

$set(album_artist_genre,$if2($getmulti(%_artists_album_primary_tags%,0),unknown))

would still place only one genre in the album_artist_genre tag. Note that this one-liner would need to be in a tagging script (rather than the file naming script) in order for it to be saved as a tag (or show up in the variables list).

1 Like

okay. I thought you has said to drop it in the naming script. I will try it as a tagging. One other idea, is it possible to have a tagging script. I’m thinking for batch tagging. Where someone could select an artist … Reba McEntire … load all of the tracks they have for that artist. The script would set the genre to Country and ignore the Picard DB ?

I suggested the naming script because I thought you had only intended to use the information for file naming (not tagging).

I think you can sort of already do that by setting the tag for the artist on MusicBrainz, and then enable the “Only use my genres” setting in Picard. This limits the tag / genre information provided to Picard to only that which you have provided in MusicBrainz. @outsidecontext provided a bit of an explanation in a comment on my PR – you need to expand the “Show resolved” section to see the discussion.

The updated version of the plugin now properly processes the genres regardless of what settings are enabled.

1 Like

I will try out the updated plugin. It maybe that with that working I wont need to change tags. Thanks again for your help. I’m going to see what work out. I just was hoping to find a simple way to “fix” if necessary tags. I guess misunderstood the part about the tags that I provide. I will go back over the user guide. Have a great evening.

@Bodevan

%SavePerfectAnyway% Is a variable I specified so that when an album is “Over Perfect” or “It’s Perfect (AFAIAC)” … that it will be save in the “Complete” path vs. with the incomplete stuff.

Only an album with a Gold Record (icon) on the Right is considered to be “Perfect” by Picard. Anything else is not.

“Over Perfect” means All the Tracks are present. There may be duplicates, multiple formats, bit rates, or all of these. To me, Complete is all tracks represented.

Such an Album is still complete, just not a perfect single set. So if $iscomplete (check syntax/script for proper use) meaning all the tracks are present regardless of duplicates, then it’s going to the Perfect path anyway.

Or… so what, I say it’s “Perfect Enough for Me”.
(I don’t care, I only want this/these certain tracks, with the album information, art, etc. anyway.) … because I don’t want to treat it as a Single when sorting. It may not be a Single track from an album, but it’s Perfect (Done) for what I’m doing. Put it with the ‘Done’, (Good/Perfect/Complete/Whatever) stuff.

The former happens automagically (if you have it enabled in the config section of the script. It is NOT a setting in Picard.

The latter happens … again, because I said so. Don’t argue with me. Make it So!

(Replied in a more proper thread)

1 Like

Thanks for replying. I see 4 places where you are checking that variable in your script, but I can’t find where it’s being set in the first place (in the v2.7 script). Can you look at it and let me know if it is being set somewhere?

It’s not a configure option in the script, it’s a tag added on a per instance basis.

With the album or all the tracks selected, you either create a tag manually or use a Tagger Script that you manually apply from the contextual menu.

To manually set it just create a new tag (lower part of the window)
called SaveIncompleteAnyway and it’s value is Yes.

When I invoke it by keyboard shortcut it’s just running the “Skip Impartial Save” script which is just doing:

$set(SavePerfectAnyway,yes)

…and then you’ll see a tag named SavePerfectAnyway with a value of Yes. That stays with the album/track and is parsed when loaded again. That is you don’t need to set it each time that Track/Album is loaded into Picard.

If you don’t want it to do that anymore then you just blast the tag and save it again, it will move it to the incomplete.

So anywhere you see something surrounded by %
%ExampleTagName% in the script, it’s checking the tag:
ExampleTagName for whatever value you’ve set.

If you see a leading underscore in there %_ExampleVariableName% then that is NOT a tag. That’s a variable and you’ll find that those are the 1 or 0 values in the config section.

Picard is amazing. As a Disk Image / ROM organizer, the workflow / scripting would be awesome!

(It’s Open Source… I know… stick a Fork in it. Go to town!)

1 Like