Author Topic: How to retrieve good quality genre tags using Picard  (Read 24984 times)

hiccup

  • Sr. Member
  • ****
  • Posts: 7783
Eventually, repetition will kick in and I'll learn to do the changes myself out of habit, so don't feel you need to go out of your way change anything ;)
Yeah, I'm sorry for changing my ways with scripts like these.
Know that I'm not a coder in any trained or professional sense of the word, and I often start concocting a script out of my amateur brain until it 'works'.
But then sometimes I find out later that it's a bit obese and convoluted, and I can leave some things out or make some small changes to improve it or make things more efficient.

Maybe that's what happened here.
I believe the latest version of the script performs very well. (It does for me)
I will check your (earlier) posts in this thread to refresh/understand what your objective regarding subgenres is again.
If I recall correctly, it shouldn't be hard to solve it by simply adding a line or two.
I'll be back. (not today ;-)
Last Edit: August 16, 2022, 11:35:32 PM by hiccup

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
Eventually, repetition will kick in and I'll learn to do the changes myself out of habit, so don't feel you need to go out of your way change anything ;)
Yeah, I'm sorry for changing my ways with scripts like these.
Know that I'm not a coder in any trained or professional sense of the word, and I often start concocting a script out of my amateur brain until it 'works'.
But then sometimes I find out later that it's a bit obese and convoluted, and I can leave some things out or make some small changes to improve it or make things more efficient.

Maybe that's what happened here.
I believe the latest version of the script performs very well. (It does for me)
I will check your (earlier) posts in this thread to refresh/understand what your objective regarding subgenres is again.
If I recall correctly, it shouldn't be hard to solve it by simply adding a line or two.
I'll be back. (not today ;-)

Maybe I can save you some timeā€¦ On the first page you mention
"extra tip:

Users that don't want their original Genre tag altered or (over)written, and have for example setup a Subgenre tag in MusicBee, only need to make a small edit in the scripts:

- In script #1, navigate to the last line saying:
$setmulti(_genremusic2,$unique(%_genremusic%))
   and change it to:
$setmulti(subgenre,$unique(%_genremusic2%))
- In script #2, add the line:
$unset(genre)

Now the Genre tag will not get altered or written, and the retrieved genres will get written to the Subgenre tag only."

That's what I've been doing. The script does work really well, I have no complaints - other than what I've been complaining about ;D

hiccup

  • Sr. Member
  • ****
  • Posts: 7783
Ah yes, you don't want 'genre' written but 'subgenre' instead.

That's still easy to do:

change the last line from
$setmulti(genre,$unique(%_genres%))
to
$setmulti(subgenre,$unique(%_genres%))

And remember to also have: $unset(genre) added to script #2
(and/or you could add it at the very bottom of this script)
It's important, because regardless of what this script does, Picard will try to write the 'genre' tag.
This 'unset' function will prevent that from happening.

I also changed the text of the explanation on how to do this in post #2. Thanks for pointing it out.

hiccup

  • Sr. Member
  • ****
  • Posts: 7783
The script was updated, a mistake concerning two genre names was corrected.

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
Ah yes, you don't want 'genre' written but 'subgenre' instead.

That's still easy to do:

change the last line from
$setmulti(genre,$unique(%_genres%))
to
$setmulti(subgenre,$unique(%_genres%))

And remember to also have: $unset(genre) added to script #2
(and/or you could add it at the very bottom of this script)
It's important, because regardless of what this script does, Picard will try to write the 'genre' tag.
This 'unset' function will prevent that from happening.

I also changed the text of the explanation on how to do this in post #2. Thanks for pointing it out.

OK, but can the last (or last couple of lines - still not entirely sure what/how they work) be used independent of your script - as in their own script or something? This way if/when you update this script, then no additional changes would need to be made - again this is just about me being forgetful/lazy.
<BTW, you can just say no and I'll stop nagging you>

I don't remember exactly what the deal was, but your second script was causing issues with my workflow so I don't use it. I just made Picard preserve the genre tag
Last Edit: August 17, 2022, 10:58:06 PM by Mr. Trev

hiccup

  • Sr. Member
  • ****
  • Posts: 7783
Yes, the script could be split into two scripts.
The first containing everything except the last two lines, and the second one only the last two lines.
You could do (and try) that yourself.

But I am not going to split the script up and publish these parts separately.
It's asking for complications for me and other users.

And all that one has to do to have the script write the genres to a desired tag other than the 'genre' tag, is change the word 'genre' in the last line to 'mygenre'. (or whatever)

I can't imagine making that any simpler for anyone.
Last Edit: August 18, 2022, 06:49:30 AM by hiccup

Mr. Trev

  • Sr. Member
  • ****
  • Posts: 454
Thanks, that was the explanation I was looking for.
I do agree it would be silly for you to split it up as a default, and just to be clear not what I was expecting either

I'll try to do the extra script and see how it works, but from what you've said, it seems like it'd probably just be a sideways move.

Cheers

hiccup

  • Sr. Member
  • ****
  • Posts: 7783
I can't see myself changing much about the structure of the script anymore.
It's pretty lean and optimised by now.
So for the future, the only thing you'll probably need to remember is changing the word 'genre' to 'subgenre' in the last line.
I'll try to remember not to change that part of the script's working.

hiccup

  • Sr. Member
  • ****
  • Posts: 7783
updated

- new genres added
- housekeeping ('unproductive' genres were removed)

l.dc

  • Full Member
  • ***
  • Posts: 164
Hi. There's something in script #2 that makes the results of the scanned songs appear all blank in the right panel of Picard. As of now I'm using it with unticking #2.

hiccup

  • Sr. Member
  • ****
  • Posts: 7783
Hi. There's something in script #2 that makes the results of the scanned songs appear all blank in the right panel of Picard. As of now I'm using it with unticking #2.
That is exactly the purpose of that script.
It's for users that want only the genre tag written/updated, and leave all other tags untouched.
(I believe I explained that in the startpost)

l.dc

  • Full Member
  • ***
  • Posts: 164
Probably I'm missing something. But saving with the second script on does delete all the other tags.

But never mind, keeping it off is anyway useful for me as the tracks are able to have some newer data in the other tags from MusicBrainz.

Thanks a lot for your awesome work!  :)

hiccup

  • Sr. Member
  • ****
  • Posts: 7783
Probably I'm missing something. But saving with the second script on does delete all the other tags.

But never mind, keeping it off is anyway useful for me as the tracks are able to have some newer data in the other tags from MusicBrainz.

Thanks a lot for your awesome work!  :)
You're welcom l.dc

Script #2 most certainly does not delete any tag.
It only prevents Picard from writing new tags, and/or existing tags getting overwritten.
What you are suggesting could happen if the script was using $Delete commands, but it is using $Unset commands, and that one does not delete anything.
Perhaps in Picard you have set 'clear existing tags'?

l.dc

  • Full Member
  • ***
  • Posts: 164
You're right. I did have 'clear existing tags' active.

By the way, does the second script do anything special compared to the 'Preserve these tags from being overwritten' in the 'Tags' section of 'Options'?

hiccup

  • Sr. Member
  • ****
  • Posts: 7783
Yes, 'preserve tags' will keep existing tags, but will allow new (empty) tags to be written.
The $Unset command prevents writting of the specified tag,