Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Use the Biography script in order to populate genre tags with MP3Tag (Read 3631 times) previous topic - next topic - Topic derived from Re: Biography Discussion
0 Members and 1 Guest are viewing this topic.

Use the Biography script in order to populate genre tags with MP3Tag

Here is a way to populate genre tags, using biography script (https://hydrogenaud.io/index.php/topic,112914.0.html) + MP3Tag software (http://www.mp3tag.de/en/ ).
The idea is to use .txt files generated by biography script. For this, you have to create an "action" in MP3Tag.

ACTION>Action>New then choose a name for the "Action" script.
in the new window :
NEW > Import text file > FIELD = GENRELASTFM / FILE NAME = location of the text file (exemple: C:\foobar2000\wsh_data\artists\%artist%\lastfm\*.txt)
NEW > Guess value > SOURCE FORMAT = %GENRELASTFM% / GUESS PATERN : %dummy%Top Tags%GENRELASTFM%Top Albums%dummy%
NEW > Format value > FIELD = GENRELASTFM / FORMAT = $cutLeft(%GENRELASTFM%,2)
NEW > Replace > FIELD = GENRELASTFM / ORIGINAL =,/REPLACE BY =;)
NEW > Format Value > FIELD = GENRELASTFM / FORMAT =$cutright(%GENRELASTFM%,4)

Select chosen tracks and apply "action". LastFM genres are now stored in GENRELASTFM tag (exemple for BLUE OYSTER CULT, GENRELASTFM should be "Hard Rock; Classic Rock; Rock; Progressive Rock; 70s; Heavy Metal"). However they're not yet reconized by Foobar as multi-value tags.

In order to correct this, select all tracks from one artist then, in PROPERTIES, make a change in the GENRELASTFM tag : for exemple, remove unwanted genres  or just add a space, and then remove it. Then click on OK. GENRELASTFM tags for that artist are now reconignised as multi-value tags.
You have to do this for each artist (I know this may be quite long, but on the other hand, it's a good way to get rid of unwanted tags (e.g: Seen Live, I Owne this Album, The Beatles, or whatever).

That's all !  :D

Re: Use the Biography script in order to populate genre tags with MP3Tag

Reply #1
one can select all artists, get properties and then rt-click field (e.g. genrelastfm) and select "split values..." to make them multi-value

also $replace can be used to mass remove unwanted tags; e.g. properties>rt-click 'genrelastfm' and select 'Format from other fields..." use pattern: $replace(%genrelastfm%,'Seen Live',)

the next thing you might want to look at is creating a tag cloud:
https://hydrogenaud.io/index.php/topic,106240.msg869128.html#msg869128

update line 15:
meta_field = "genrelastfm";

Re: Use the Biography script in order to populate genre tags with MP3Tag

Reply #2
Can this method also be used to populate a tag value based on file name of a json file within a folder instead of what is inside a text file?
For example C:\%artist%\musicbrainz.links.382f1005-e9ab-4684-afd4-0bdae4ee37f2.json  populate json filename to %musicbrainz_artistid% of %artist%.

Re: Use the Biography script in order to populate genre tags with MP3Tag

Reply #3
In theory, that should be possible. However, json files are very inconvenient to use (it's difficult to choose the right syntax in order to format value and extract informations you want to include in tags).

There is a script MARC2003 created (I think it's marc2003's old biography WSHscript) which generates a .txt file with Musicbrainz_artistID information. It's in plain text, so it's quite easy to use.
Actually, I used this method in order to populate my whole music collection with MUSICBRAINZ_ARTISTID tags. Trust me, it was very usefull ! 

NEW > Import text file > FIELD = MUSICBRAINZ_ARTISTID / FILE NAME = location of the text file (for me: C:\foobar2000\wsh_data\artists\%artist%\musicbrainz_artistid.txt)
NEW > Format value > FIELD = MUSICBRAINZ_ARTISTID / FORMAT = $left(%MUSICBRAINZ_ARTISTID%,36)


Re: Use the Biography script in order to populate genre tags with MP3Tag

Reply #5
In theory, that should be possible. However, json files are very inconvenient to use (it's difficult to chose the right syntax in order to format value and extract informations you want to include in tags).

There is a script MARC2003 created (I think it's marc2003's old biography WSHscript) which generates a .txt file with Musicbrainz_artistID information. It's in plain text, so it's quite easy to use.
Actually, I used this method in order to populate my whole music collection with MUSICBRAINZ_ARTISTID tags. Trust me, it was very usefull ! 

NEW > Import text file > FIELD = MUSICBRAINZ_ARTISTID / FILE NAME = location of the text file (for me: C:\foobar2000\wsh_data\artists\%artist%\musicbrainz_artistid.txt)
NEW > Format value > FIELD = MUSICBRAINZ_ARTISTID / FORMAT = $left(%MUSICBRAINZ_ARTISTID%,36)

If only going off the filename itself and not the content of the file does it really matter which type of file it is?

Re: Use the Biography script in order to populate genre tags with MP3Tag

Reply #6
My mistake, I thought informations were included in the JSON file. Well, for now, I have no idea how you might do this.

Re: Use the Biography script in order to populate genre tags with MP3Tag

Reply #7
The information is indeed included but, as you already mentioned before, it's a bit inconvenient hence filename would be much simpler. Perhaps I'll check that old WSH script of marc2003. You don't happen to have a copy of that have you?

Re: Use the Biography script in order to populate genre tags with MP3Tag

Reply #8
Never mind, found a handy workaround with some batch operations and text tools.

Re: Use the Biography script in order to populate genre tags with MP3Tag

Reply #9
May I ask you how you did that ?

Re: Use the Biography script in order to populate genre tags with MP3Tag

Reply #10
Using this batch script operation as an example:

Code: [Select]
rem Saved in D:\tag data\bat\run.bat
@echo off
@echo f37c537b-3557-4031-bfd6-ab63ced32854>> 104394872.txt
@echo  4f1949ab-fefd-4bf3-9317-814084c29cc0>> 2619264081.txt
@echo  f9af11e9-40c4-42c0-8ea9-99b9c84868057>> 3074071749.txt

The long set of numbers are musicbrainze_artistid and the second set are unique key identifier for an artist to which the mbid_artistid corresponds. You could use artist name instead of a unique key identifier but bat operations  isn't unicode so this tends to give problems with special characters. A set of numbers are no problem however and I had those already since I use those for data import into an sqlite database.
First I search for all metadata that has musicbrainze_artistid present, then I use  text tools -> advanced and fill in my track pattern also including the commands for the bat script: @echo  %FORMED/BORN%>> %FOO_ARTIST_ID%.txt. I select skip duplicate/repeating lines.
Then I copy paste the entire selection in excel to further delete duplicates since text tools doesn't fully do that.
Then I copy paste from excel into a txt file and add the top two lines to the batch srcipt
Code: [Select]
rem Saved in D:\tag data\bat\run.bat
@echo off
(path must be adjusted to what you use of course)

Then I run the script and it will result in multiple text files with each text files named as the unique key identifier  with each file having the musicbrainz_artistid corresponding to that identifier (and subsequently to a specific artist).

The rest you know, I use your method via MP3Tag top populate my Musicbrainz_artistIds. The benefit here is that I don't need to add a Musicbrainz_artistIds. to newly added files when it is already present for that artist in the library.


Btw, if you want to use a key identifier for your artists like I use, this is the formatting pattern using masstagger (format value):
Code: [Select]
$if2(%FOO_ARTIST_ID%,$crc32($lower([%artist%])))

 

Re: Use the Biography script in order to populate genre tags with MP3Tag

Reply #11
That's smart ! Thanks