Automatic addition of TAG data from a text file

Hi guys, I hope you can help...
I have a large collection of digitised cassette recordings, 45 RPM singles, 33.333 RPM LPs, and even some 78 RPM, erm, singles, I suppose. I also have a Word table listing the titles, artists, dates, labels, etc, which I had plenty of time to type in while each record was being digitised in real time. The original digitisation provided .WAV files, which I have since converted and saved to a different location as .MP3 files. Each WAV (and therefore MP3) file has a unique filename as supplied by the digitising recorder, it is cryptic, and the only way to see which tune is which is to refer to the Word table. The unique filenames do have a good side - there are no duplications even thought some songs might be the same as others.
I can convert the Word file into various text formats (CSV, TSV, Return-SV) easily enough which provides me with a source of data. What I want to do now is to use that data to add TAG information to each MP3 file, and as there are over 1,000 files I want to automate the process.
Its easy enough to automatically change the filenames to, e.g., title and artists, I have already written a Python program that runs on the Raspberry Pi to do just that. There is still no duplication because a third 'field' in the titles is the significant part of the unique filename. But now I want to add metadata, and this is where the story really starts...
How can I automatically add metadata to each MP3 file, preferably at the same time as changing the filenames to title and artist? All the information is there, the existing program uses each filename to search for the title/artist information and changes the filename as it stands.
I am hoping that MP3TAG can do what I want, and I have read an awful lot of the information on this site that suggests it might. But before I part with cash, I need to know for sure. There are built-in routines for accessing data from the internet, but the internet information is a) not always right, and b) probably unavailable for single tracks that are not part of an LP or CD.
Here's hoping...

Is this about the Mac version?
The windows version is freeware.

Hello ohrenkino, that was quick! No, not the Mac, probably Windows, maybe the Raspberry Pi and Linux. I realise the program is freeware but if it works as I hope then I would certainly contribute to the cause in return for saving my fingers and many hours of my time.

There are 2 functions to import data from text files:
A Converter: Mp3tag Help - convert tags from/to filenames
an action: Mp3tag Help - Configuration / Actions

I did have a look at those, but at the time I was anticipating having only two fields (title and artist) in the filename. I realise now that more might be possible, I'd have to check on the maximum number of characters allowed in a filename and what the field separators need to be. What's more, once the metadata has been installed, I could change the filenames again to something much shorter without losing it. My car radio would be delighted! I also need to check the format of the required data file.
Just had another thought - if Mp3tag picks a track, e.g. 'CFB0099.mp3', it will probably have to search the table until it finds the data relating to that track. Can Mp3tag do that?

The filename has nothing to do with importing data from text files, except ...

that MP3tag aligns the data in the text file with a taggable file using the filename.
The field separator has to be unique, preferably a printable one.

Hmmm, ok, let me see if I'm getting this right... Does that mean that a separate text file is needed for each MP3 file, with both having the same filename? e.g. Perfidia.txt and Perfidia.mp3? And the wanted metadata being the data within Perfidia.txt being used to create the metadata block for Perfidia.mp3?

you need a text file with one record per line.
One field of each record contains the file name of the taggable file.
The rest of the record should contain the other data for the fields.
Each record is defined to be one line of text, terminated by CR&LF.
The field separator in each record has to be unique and must not be part of the field data.

A different way would be to still have data for more taggable files in the data file but without the filename as part of the record.
Then the records from the data file are assigned to the selected files where the first record is assigned to the first selected file, the second record to the second file and so on.

Ah, ok, I'm nearly there then. My Word table is set up so that each row is a record that applies to one tune, the columns are the fields headed Title, Artist, Writer(s), Date, etc. I have deliberately avoided using TAB in any of the fields and have saved a text file from Word that uses TAB as the field separator. I can specify the record separator, I'm pretty sure I selected CR/LF. So Mp3tag uses the filename within each record to search for the mp3 file of the same name and then to work on it.
My unique filenames are the last field in a row, I probably need to change that to be the first field and globally change .WAV to .mp3 for it to work. I'll go back and look at the documentation for that.
I have misgivings about not supplying filenames. I've had problems with Bill Gates and his Random Auto Disorganisation Of Filenames before. As it happens in this case it is an easy thing to avoid.

Got to go now, those dustbins won't put themselves at the side of the road. Thanks for your help, it is much appreciated. I'll download the Windows version and let you know how it goes.

The very nice thing about having these unique identifiers is you will use that field as your sorting option. If as you say there is one line per file, and you have the exact number of files that match, this should be a straight dump once you have it set up. Obviously run a test or two before you commit.

When you are ready, load all files to mp3tag (easier if they all reside within a higher level folder), then apply the function to use your data file as mentioned by @ohrenkino. And by some voodoo magic (under the rule of the great wizard @Florian ) your tags should suddenly exist.

Once you confirm all are as expected, you could go one step further and have mp3tag even rename your library with filenames that no longer use unrelated numbering schemes. They could reflect the actual Artist\Album\Disc-Track_Title or similar if you prefer. At least in the future it would help to keep your files organized.

Yes, I'm so glad I kept those unique filenames as part of each record. When I wrote earlier that there were some songs that are the same as others, I didn't mean identical. For instance, I might have four copies of one song, these being the 45rpm single, the LP track, the CD version, and the recording from 'Pick Of The Pops' on Sunday afternoons using an AM transistor radio tuned to the Light Programme on long wave. Those were the days (c. Hopkin, 1968). I find it quite amusing when the random play picks out the scratchy old ex-juke-box 45 single version on the car radio - the reactions from passengers, especially when the needle drops onto the disk, are often the high spot of the journey!

Hello again all, I'm still missing something. I have a text file ready to either Copy or Import to Mp3tag, but most of the buttons in the menu bar are greyed-out as are the text options above them (File, Edit, View, etc). Although they produce sub-menus when clicked, only a few of the items change to blue. 'Paste' changes to blue, but when I click it nothing happens.
The menu items that are active (in colour) are the six in the second group along, 'Change directory' to 'Refresh file view' inclusive.
I have seen something somewhere about pressing one of the F-keys to activate menu options but I can't find it again, and it may not have been referring to the menu bar buttons anyway.
The Directory in the lowest box of the left-hand panel is correct, I have compared it very carefully with the directory shown in the text editor while it is displaying the file I want to import and they are identical.
I've tried looking through the instructions but cannot find anything other than 'Paste' which will enable the loading of multi-record text files. Sometimes 'Paste' will display one title at the top of the left-hand box, but not always. All the items in the text file were selected and Copied, of course.
I've tried to use the recommended Action for loading multi-record text files. The 'Actions' selector brings up a sub-menu, but none of the five options turn blue when I move the mouse pointer over them. So I have been unable to do that.
At the moment I am baffled. I think I have tried everything, but obviously not!

Have you selected the tracks you want to apply the action to? Or select all to do the entire batch? Only when at least one track is highlighted can you perform any actions.

Hi MotleyG, thanks for the reply. The main problem was that 'Paste' didn't work, so I was unable to load any files at all, let alone do things with them shortly afterwards. I'd even tried dragging and dropping the text file to the middle of the large Mp3tag window, just as I have been doing with text files to Excel for many a long year, but to no avail. *** Major Breakthrough Alert *** I have now managed, more by luck than judgement, to load the title fields with the titles of the 10 MP3 files that I am using for test purposes. Their filenames are also present. But I havn't got any Artists, Composers, or any other fields even though the data exists within the text file. I have tried a few things and the nearest I've got is to add the titles to the Artist field, so the titles now appear in both columns but with no Artists.
Am I right in thinking that I need to include the placeholders (%composer%, %date%, etc) in the data file so that a typical data item would look like:
...(previous field data)%date%1963(next field data)...
and does the text file need to have a specific filename in order to be picked-up by the mp3tag program? The example in the instructions isn't all that clear as it only describes what to do with one field. Or do I need a format string, and if so where does it go? I'd assume at the beginning of the text file, but maybe not...
Thanks in advance,

@33-45-78 are you following the steps from Mp3tag Help - convert tags from/to filenames ? You need to add the track files to mp3tag, then use the text-tag function and assign your text file as the source. Two important factors: 1) sort the files in mp3tag to match the source text file exactly, and 2) make sure you have a unique separator in the text file between your fields and tell mp3tag what that separator is.

There shouldn't be any use to drag and drop the text file, or to copy/paste in this case.

@Florian are the fields limited to just those found in the list here? Mp3tag Help - convert tags from/to filenames
Or can other typical fields also be used, such as Album Artist?

You can write the data from the text file to any field you like. The fieldname is determined by the %-syntax. So

would be addressed as %album artist%.
I would advise, though, to use the proper field name straight away which is %albumartist%.

An interesting but not (yet?) supported approach:
You have to supply these things for the import of data from a text file:
the target files have to be loaded into MP3tag and selected.
the data (text) file has to be prepared with data only (that means: no list of fieldnames as first line in the file) and one line per record.
Each record has to have the same structure which means that if you transformed that data file into a table, then all filled table cells have represent the same data context (e.g. the TITLE). And if you want to use the addressing and not the sequence scheme then each record has to have a field with a full filename: %_filename_ext%.
The fields are addressed by their position in the list of fields, no field name has to preceed the data, so,

would lead to a field with the contents %date%1963
If you want to get just the 1963, leave out the fieldname here but supply it in the list of fieldnames.
The import then works as follows:
Select the files,
Select the function Convert>Text file - Tag
Enter the list of fields and their separators exactly as found in the data file.
Supply the name of the data file.
Start the converter.

Hello again, I'm getting a bit closer! I have copied the mp3 files into Mp3tag, the mp3 filenames appear in the table under Filenames, the most recent modification data appears under Modified, and the titles appear under Titles. I then selected them all and executed Convert Text - Tag. At this point a list of ten error messages appeared in a small box, they were all "Cannot parse line n" where n is a number between 1 and 10. Then I realised I had not told Mp3tag what character I had used as a field separator.
I found a data entry box that requested a filename and a format line - it looked hopeful but when I tried putting the cursor in the latter and pressing the tab key the cursor disappeared and nothing else happened. I closed the data entry box and tried the Convert Text - Tag again but nothing seemed to happen.
Under a settings menu I found something like "Select line separator" but try as I might I cannot find any way to specify the field separator. I have pored over the instructions and help info to find how to do it but to no avail. My gut feeling is that Mp3tag is using a default field separator, it isn't TAB (=chr(9)) and I cannot find a way yo change it. As an aside to that, I cannot find anywhere that tells me what the default is, so I can't even change my Python program to match it.
I'm hoping I can attach my text file and the Preview file from Mp3tag - they both look good to me so I'm lost again! I would be grateful if you could look at them and instantly spot any number of glaring errors... 'Attachments' attached - they don't look like any attachments I've seen before!
Regards, 33-45-78
preview.txt (961 Bytes)
TAGinfo.txt (1.2 KB)

Concerning the field separator:

The tab character is usually not printable as it does not show and serves as navigation key. Getting the tab character as field separator is tricky as you have to create the string outside MP3tag in a text editor.
I would use the text editor and replace the tab character with a | or an _.

I am missing the field list in your description. So it would nice if your could show us the field list as well plus the then used field separator.