MB2mp3tag - PawelTrela/My-projects GitHub Wiki

MB2mp3tag

Preface

MB2mp3tag is an application for downloading music's metadata from musicbrainz.org and saving it in a format that can be used by mp3tag.

Musicbrainz.org is a huge database (https://musicbrainz.org/statistics) containing detailed information on music releases: titles of songs, compositions dates, recording dates, composers, performers, recording locations, etc. This information is stored in a relational database (https://musicbrainz.org/doc/MusicBrainz_Database/Schema).

The mp3tag (https://www.mp3tag.de/en/) is my favorite application for tagging music files. It has many functions, it gives the possibility of manual and automatic editing of music tags.

The mp3tag application allows you to set tags for a songs by loading them from a text file. In this file, all information about the song must be listed in a single line. Musicbrainz.org makes the data available in a dispersed form. Releases' data can be downloaded separately, data for each recording separately and separately for each artist (composer or performer). My application (MB2mp3tag) is therefore the link between musicbrainz.org and mp3tag. It downloads data from the musicbrainz.org website in the form in which it is possible, processes them and saves them in a text file in such a format that it can be used by the mp3tag application. The source data are xml files. The release is downloaded as an xml file, every recording presented in this release is downloaded as another xml file, each artist (artist, composer) is downloaded as a separate xml file. For only one medium (disk) containing several recordings, we may already have to download almost 100 xml files from musicbrainz.org. Musicbrainz.org "dislikes" when it needs to share a lot of data within a short period of time (https://musicbrainz.org/doc/XML_Web_Service/Rate_Limiting). It is recommended that there be at most one reading per second. That's why my application has a local cache. Each xml file that you download from the server is stored in the local directory. This makes the creation of tags for subsequent releases faster and faster, as more and more data is available locally over time.

How to use the application?

Let's say you have music files from the Mozart Piano Concertos (Andras Schiff) release. You want to tag them in the mp3tag application. First you are looking for this release on the musicbrainz.org website. It is at https://musicbrainz.org/release/b0837172-673c-4416-80d6-8a5801e6f102:

So you copy this url to the clipboard and run my program, giving the copied address as an argument:

MB2mp3tag.exe https://musicbrainz.org/release/b0837172-673c-4416-80d6-8a5801e6f102

MB2mp3tag - run application

The application starts working and after a few tens of seconds in the file Piano Concertos.txt you have stored data for the tags:

MB2mp3tag - application finished creating output file

Next you open the mp3tag application, load a directory with music files into it, and launch the Convert > Text file - Tag action:

mp3tag - configure action

In the dialog that opens, in the File name field you give the path to the file that was created by my application, and in the String format field you specify the template that my application prepared the data from (by default: %discnumber%|%disctotal%|%album%|%track%|%tracknumber%|%tracktotal%|%title%|%composer%|%artist%|%year%|%organization%|%comment%|%url%). You confirm OK and after a while your music files are tagged:

mp3tag - tag's updated

And here's how it looks in music player:

aimp3 (music player)

How to download and run MB2mp3tag application?

Go to subdirectory executables in this repository: https://github.com/PawelTrela/My-projects/tree/master/AudioTaggerWithMusicBrainz/executables

There are the following files:

MB2mp3tag.exe - Windows executable file. Save it on your drive, run windows console, change directory to the one where you saved MB2mp3tag.exe file (e.g.: cd c:\!moje\) and then you can run program, typing its name and giving argument and options (run: MB2mp3tag.exe -h to see all available options).

MB2mp3tag.jar - executable java archive. To run it, open windows console and type: java -jar MB2mp3tag.jar <argument>

You can control behaviour of the application with command line options. Alternatively, you can use properties file. To do so, download MB2mp3tag.properties file and save it in the same directory where executable file is located. You can edit this file in any text file editor and change parameters as you will.

For debugging purpose, there is a file log4j2.xml. If you download it and save in the same directory where executable file is located, then application will gather some debugging information in file MB2mp3tag.log.

⚠️ **GitHub.com Fallback** ⚠️