This post is intended to summarize various other threads and my experience on the subject of creating MP3 tags from text files. Also, I want to offer some suggestions I have found useful. The online Help files at this time simply do not provide enough details to use this feature. I had to use earlier posts here and my own experimentation to determine how to make this feature work. This post may seem long and too detailed, but if you have several thousand "loose" files (no album organization) as I and another poster had, then these steps may save you some time.
MP3Tag offers several ways to import tags, the 'Text File --> Tag' feature being one of them. Obviously, this method is useful only if you have a data file or can obtain or prepare one relatively easily. If you have to build the data source from scratch, you may be better off entering the tags manually. Also, you benefit more if you have a lot of files to tag rather than a few. You have to compare the time it takes to prepare the list versus how long it would take to enter the tags manually or try to use auto tagging. (Auto tagging seems to work best if your files are organized by album.)
Another factor to consider is your current file names. If you have file names that include artist, album, track number, etc., you might be better off using the File Name --> Tag method. However, if you have files where the order of the data elements varies in the file names, the Text File method may be better because you won't have to continually change formats for each file name difference. In my case, I had only the song title in the file name, but I had built a spreadsheet over the years with 20,000+ songs. (Yes, I know. Get a life.) So, the Text File --> Tag method had great potential for me.
**Data Sources
You may have your data in a database such as Access, in a spreadsheet (Excel) as I do, in a word processing document or in a text file. Regardless of the source, the key is getting the final data into a format that matches the format string that must be defined in the program (see below for more on format strings). I prefer a spreadsheet because it works like a 'flat' database file. It is easy to sort. Data elements (columns) can be moved to change the order of the final output. Also, a spreadsheet makes it easy to add the same data values to many records at a time. I can sort my spreadsheet by artist, for example, and quickly add the same genre value to all the songs of that artist.
In a couple of threads there has been discussion of CSV (comma separated values) files. Typically, the data elements are separated by commas with quote marks around text strings especially if the text strings contain commas. Personally, I have found it better to save the data as tab-delimited. In the spreadsheet, I hit Ctrl-A to select all the data, then Ctrl-C to copy all the data. I then paste the data into a text editor. Alternatively, you can click on File\Save As and save the file as a tab-delimited text file.
**Why use a tab-delimited file rather than a CSV file?
- Eventually, the file will need to contain a character that acts as a delimiter or separator between each data element in each record. It can be just about any regular keyboard character - as long as it is not used in any data element. Examples are / ; ~ ` | *.
- Commas are not good delimiters because they are often found in titles.
- MP3Tag might assume the quote marks belong in the data elements, so they must not be in the text strings.
The developer has stated that MP3Tag does not support processing of CSV files in their normal format with quotes marks. It can be used only a single data delimiter.
I use a text editor that has the ability to search for characters such as tabs or paragraph marks and replace or add to them other characters. If I have a text file record that looks like this:
c:[user]\Documents and Settings\My Music\filename.mp3 {tab} artist {tab} title {tab} year {tab} genre
I search for the tabs and replace them with a new delimiter or separator (/ or *) so that each record in my text file now looks like this:
c:[user]\Documents and Settings\My Music\filename.mp3/artist/title/year/genre
c:[user]\Documents and Settings\My Music\filename.mp3artisttitleyeargenre
One thing to watch out for in creating data sources and then moving them to a text file is spaces at the beginning or end of data elements. These can prevent matchups from occurring or can result in data being entered with the spaces embedded, making searches difficult later. In my case, I could use the text editor to replace {space}/ or /{space} with just /. That would remove any extra spaces.
Note that you would not actually see '{tab}' or '{space}.' The {tab} would be a blank area or some symbol such as >>, depending on the editor used and the display options selected. {space} is just the space bar hit once. The key is having a text editor that can search for such characters. Also, word processing programs such as Microsoft Word have the ability to search for and replace such characters. Trying to replace commas in a CSV file could be a problem if there are commas in titles. Also if there are commas in titles and you use commas as your delimiter, those records will fail.
**Building the Text File
Some of the details are discussed later, but here are some key points to remember as noted by the developer of MP3Tag:
- No empty lines in the text file. Also, no header or footer lines. Only data records with one row per record.
- Identical number of lines in the text file and selected tracks within Mp3tag.
- Each line in the text file must have an absolute filepath entry.
- Import tag mask must have a "%_path%" entry.
- The binding relation is the absolute filepath.
The MP3Tag program does not treat the text file like a database and search for matching records in the file. The program has to have data in the each record that matches a selected record in the files window. You can have multiple folders imported with all records in every folder selected. That is why the filepath entry is key. This is discussed in more detail below.
Item 2 is important as one user found out. In a post he said, "What otherwise would have been an enjoyable experience was a usability nightmare, as mp3tag presented me with a dialog box asking if I wanted to continue each time it encountered a line in the text file that didn't have a corresponding mp3. The choices were YES, NO, and CANCEL. As one import that I performed had 70 mp3s but approximately 850 lines in the text file, this was a painful process of holding down the 'Y' key (for yes) for perhaps 10 minutes to get mp3tag to continue through the import process each time it presented the dialog box."
The key is to build or edit a text data file that matches or covers the folder(s) you want to process. In my data source, I had folder names which enabled me to work with only that portion of my 20,000+ records that I needed to update the tags on. I was able to export the 2,000+ records I needed into another spreadsheet that I could then work with.
I have not seen anything so far that says the text file records have to be in the same order as the selected files in the program's files window, but I would try to organize the text file to match if possible. By default, MP3Tag sorts file names alphabetically within each folder displayed. Knowing this, the data source (spreadsheet for example) should be sorted in that same order before exporting the data to a text file. Even if this is not required, I would do it anyway just to make things easier.
**Format Strings
When you select one or more files in MP3Tag, the Convert menu items and the related conversion icons on the toolbar are enabled. The 'Text File --> Tag' is the one with the yellow arrow from a lined page to the red dot. If you click on that icon (or select Text file - Tag from the Convert menu option or hit Alt-4), you will get a dialog. You first enter or browse for the source text file name. Initially, the second field - Format string: - will be empty. By clicking on the right arrow button on the right, you can select the various elements - one at a time - that match your text file. Select them in the same order as the elements are in the text file. Using my example above, I would have:
%artist%%title%%year%%genre%
Here is the key. Now click in the Format string field and manually add your delimiter to the string so that it looks like this:
%artist%/%title%/%year%/%genre%
You may see this referred to as an import tag mask or placeholder. The main thing to remember is that it tells the program how your data are arranged in each record and where the data goes in the various tags.
What if I have data in my source file I don't want added to the tags. Here is what the program developer says:
You may use the %dummy% placeholder as part of the format string to supress unwanted values. Having a line with many different values like:
Blue Sky Boys - Are You From Dixie;Various Artists;American Roadsongs - cd 5 - Are You From Dixie;20;1950;159;2.42 MB;25/01/2009;
%Title%;%Artist%;%dummy%;%dummy%;%Year%;%dummy%;%dummy%;%dummy%;
This results into three tag fields TITLE, ARTIST, YEAR and nothing more.
**Path-Folder-File Names
In my earlier example, I had 'c:[user]\Documents and Settings\My Music\filename.mp3' as part of the data element. Why is this needed? What goes in the format string? According to the long thread on this subject in March 2009, the fully qualified path and file name is necessary for the program to process the records.
- The data element you need in the format string is not available from the dropdown list. You need to add it manually. Based on the long thread in March 2009, %_path% is the element needed. So that my final format string looked like this:
%_path%/%artist%/%title%/%year%/%genre%
You can create different format strings if you have different data sources. The formats are saved, and the last one used displays the next time.
- Let's look at the path-folder portion first. Depending on whether you are using Windows XP or Vista, the path name may vary. Don't start with the My Documents (XP) or Users/Documents (Vista) folder. Go to the C: drive and drill down through the users to Documents and Settings to the actual folder with the files to be tagged. In my example, [user] would be replaced with an actual user name.
You can add the path-folder name quickly in a spreadsheet by inserting a blank column at the left of the data. Type or paste the full path name into the first row. Then use the spreadsheet's Copy feature to duplicate the path in each of the following rows. This assumes all the files are in that path. Remember that the path includes the folder containing the files. If they are in a folder under 'My Music,' that must be included.
- File names. If your original data source contained the files name, then a little editing trick can merge the path and file names. Arrange your data source (a spreadsheet is easier to do this) so that the path name column is to the immediate left of the filename column. When you export the spreadsheet to a text file as discussed above, you will have
c:[user]\Documents and Settings\My Music\ {tab} filename.mp3
Use your text editor's search and replace to replace '\My Music\ {tab}' with '\My Music'). The data element will then look like
c:[user]\Documents and Settings\My Music\filename.mp3
- What if you don't have the actual file names in your data source? There are a couple of things you can do. If the file names and the titles are the same, you can create a blank column in the spreadsheet and copy the titles column into the blank column. Then you add another column after the 'filename' column and put .mp3 in each row of that column. When you get the data to the text editor, use the same trick described earlier to merge the two columns together:
'filename {tab} .mp3' became 'filename.mp3'.
But what if my file names don't match the titles? Editing individual file names is out of the question.
I have a program called Directory Printer. There are several freeware or shareware programs like it. We need to process data in bulk. So, a few dollars for this program paid for itself in this one project in time and effort saved. I selected the folder containing the files I wanted to process. Using the program's options, I made sure I was getting files names with full directory/folder names. I was able to export the results to a tab delimited file which I got into another spreadsheet. Ultimately, I moved the data to my original data source spreadsheet. Because of common data elements, I has able to match the path\filename data with the matching records based on folder names and titles. It took some manual effort to fully integrate the path/file names with the base data, but it was a lot less time than it would take me to manually add tags to 2,000 files.
- What if I want to process files from a number of different folders at one time? Using the method just described in item 4 is the best and easiest way to build a file from multiple folders or from several levels of folders. As noted earlier, in the spreadsheet, you can sort by the path name and then by the file name to get the records in the data file to match what MP3Tag will display when you select the folders for processing.
**Data Cleanup
One advantage I found from this matching of my original data source with the path/file names was that some of my file names were mis-named when compared with my original data. I corrected the actual file names in their folders to match changes I made in the data file. Of course, I could have left the files names as is - as long as the actual file name matched the "file name" in the text file.
The file name is a concern if you build the file name from the titles or from some other source as I suggested earlier. I cannot say exactly what might happen when the program finds records in the text file or in the files list that it cannot match with the other. The program may just skip the record and move on. Once you know that the data are being correctly placed in the tag fields, then you can run the full file, or that part you did not use in testing.
**Testing
If you have hundreds or thousands of records in your data file, it is a good idea to test the file and the program on a small sample of data first. Copy a section of data from the text file and save it to a new file. This ought to match a single folder or small group of folders. If you have all your files in one folder, you will need to select a portion of the records and then in the program's files window, select only those records that match the sample text file.
Use the preview button on the dialog to look at how the program plans on processing the data. Your default text editor will open showing data formatted like this example from the developer in another thread:
Having a line with three different values like:
Blue Sky Boys - Are You From Dixie;Various Artists;1950;
And a formatstring like:
%Title%;%Artist%;%Year%;
It should result into three tag fields for one music file:
TITLE=Blue Sky Boys - Are You From Dixie
ARTIST=Various Artists
YEAR=1950
Look through the preview file, especially if you get a notice that not all the records were processed correctly. The file may help you locate records or file names that need to be corrected.
One user had Notepad as his default text editor, but when he ran several thousand records through and tried to use Preview, Notepad could not handle all the rows of data created. There are a number of freeware and shareware text editors that work much better than Notepad. For this reason, and for data search and replace method mentioned earlier, I would recommend a more robust text editor.
**Final Processing
If you are satisfied with the preview results, or you have stopped and edited your file to correct any problems, return to the Text File -> Tag dialog and click on OK. Depending on the number of records, it could take a while. The program will tell you how many records were processed.
Last Step: While the processed records are still selected, click on the Save icon or type Ctrl-S to save the updated tags.
Now, you will have dozens or hundreds of files with their tags set.