Get tags from file

Thanks i'm an old man, so heres what i have i'll let you figure the hard part (This is humor btw)

I have MP3 files named as follows 19604625C.mp3 as an example, the C at the end can have a different letter 3 different types i believe

I have managed to get a text of the tags which were in a borland paradox db file

The first field would be the matching field so it would look like this

|19602232 |Buddy Holly |True Love Ways |5 |29/05/1960 |32 | |
|19604125 |Johnny And The Hurricanes |Rocking Goose |3 |09/10/1960 |25 | |
|19604501 |Elvis Presley |It's Now Or Never |16 |06/11/1960 |01 | |
|19604625 |Shadows |Man Of Mystery |3 |13/11/1960 |25 | |
|19604923 |Cliff Richard |I Love You |16 |04/12/1960 |23 | |
|19604937 |Johnny Tillotson |Poetry In Motion |3 |04/12/1960 |37 | |

The above 6 lines have been edited to remove unnecessary white space to aid viewing

Only the first three fields are important data i want to keep

1= Code (MY NAME) For this data
2= Artist
3= Title

So when i run the match any mp3 file with a name that matches the first 8 characters will have the Artist and Title field updated

At a later time i will rename the files using the built in rename from tags function

If someone could do this i will be so happy

The text file will have approx 7000 lines and there are approx 9875 mp3's that i want to rename

If this is a problem i could make the text files smaller and run on individual folders

Thanks

There is the function Convert>Text file - tag
(Import Tags from Text Files – Mp3tag Documentation)

You can import tags form a text file either ...
from a text file where the sequence and number of the records in the text file matches that of the selected files
or ...
from a text file where there is one field per record that represents the filename - MP3tag would then take the rest of the data from that record to assign it to the tags in the named file.

If you want to use this convert function, then you have to supply a list of fields which should be imported, separated by the correct separator.
E.g. this record structure
|19604625 |Shadows |Man Of Mystery |3 |13/11/1960 |25 | |

could be imported with such a mask:
|%my_id% |%title% |%artist% |%track% |%mydate%|%dummy% |%dummy%

if the number 19604625 is actually the filename, you would have to add .mp3 in the data source, so that the record becomes:
|19604625.mp3 |Shadows |Man Of Mystery |3 |13/11/1960 |25 | |
and the mask could modified to:
|%_filename% |%title% |%artist% |%track% |%my_date%|%dummy% |%dummy%

Thanks i'm gonna try this out later, i'm in no rush as i have been waiting 14 years do this task (Humor :smiley: :smiley: :smiley: )

Well i finally tried it out couple of things i changed and it works perfectly

|%_filename% |%artist% |%title% |%dummy% |%dummy%/%dummy%/%year% |%dummy% |%dummy%

Was the final string

I am so so happy .Thank you so much

My euphoria was short lived, having spent some time testing this it doesnt work how i would like.

An mp3 called 19802524.mp3 would only be renamed if it found matching text in the text file

As it is the first mp3 is renamed to the first line in the txt file

I have been looking around and see there are scripting functions

I need a script kiddie :frowning: anyone able to oblige.

The import of data from a text file has 2 modes:

1: the number and sequence of files matches exactly the number and sequence of records in the text file. One record is represented by one line of text, terminated by the paragraph termination characters carriage return and line feed.

2: a record contains one piece of data that represents the filename. Then the data of that record is assigned to the tags in the file according to the rest of the mask.
The number and sequence does not necessarily have to match each other.

So you have to decide which of the 2 modes you want to use.

If you can, use mode 2 as this leads to the fewest surprises. You would have to find a way to get the field for the filename (with extension), though.

For the import in mode 2, select all files, even if they do not have a matching record or even if there are more records in the text file than there are files. This should work... as long as matches are found.

Hi all,
This is very powerful and useful - however I am having problems getting it to work in mode 2.
I have tried more entries in the file than selected MP3Tag files and the other way around but it always seems to work in mode 1.
It would be really nice if you could select which mode you wanted it use - regardless of the number of selected records and the number of file entries.

Regards Terry

one of the fields in each record has to be %_filename%. If the contents of that field matches the filename, then the contents of the other fields get assigned to the tag fields in the file.

Thanks for the prompt reply.
I am pretty sure I tried %_filename% in several scenarios - but I will have another go.

Ideally if you want and could select mode 2 and no matches occur (for whatever reason) it would not do anything - at the moment, as I understand it, if no matches occur it will switch to mode 1 and potentially mess up your (mp3tag) files with all the wrong information.

Regards Terry

No, you would get an error message that the lines could not be parsed - simply because the fiield %_filename% is included in the mask but not in the data.
Or you have the field %_filename% but you have not mentioned it in the mask - so the records and the import instruction do not match.

Hi Ohrenkino, Silver Surfer,

After a bit of investigation I have found that a small typo in ohrenkino's script and instructions has been causing the problem.

Rather than using %_filename% it should have been %_filename_ext%.
This now works perfectly in my tests and only uses mode 2 and reports any matches it did not find.
It also does not switch to mode 1 if it finds no matches at all

So if Silver Surfer is still listening here is a modified version of the script that should work for you.

|%_filename_ext% |%artist% |%title% |%dummy% |%dummy%/%dummy%/%year% |%dummy% |%dummy%

It seems that mode 2 (IE when it searches the text file for a match) only works with %_filename_ext% but that is not a problem - just glad to have this powerful feature working.

Regards Terry

Well thank you guys just as well to check back

Terry i will try this out later and post back my results

This program is clever unlike me

Just tried this out, i picked a random file somewhere near the middle and it failed which is a good thing the error was no "matching file"

So Terry you missed this bit a filename will have at the end of the numbers a letter as in 19901225C.mp3 but the text file will not have the C if there is a matching record it will be 19901225

So what i'm wanting is to ignore the C in the filename

I'm so close to utopia

That's great we are step nearer.

Yes, you mentioned in a previous post that the actual file name may have up to three different letters at the end.
The problem here is that %_filename_ext% has to be used to get mode 2 (the search mode) to work and it has to match the file name in the text file.
I believe you have already added .mp3 to make up the file names in the text file so a quick solution would be to change it (using a text editor) to c.mp3 this will add the C to the end of all the file names in the text file.
For example: 19602232.mp3 becomes 19602232C.mp3 in the text file.

Then run the MP3Tag convert function - this should process all the files with a final C and, importantly, ignore the rest.

Then (using a text editor again) change all the c.mp3's to (say) a.mp3 in the text file, then run the MP3Tag convert function again to process all the matching files that have a A at the end and so on.

It is bit of a clunky solution but should work.
Note: I have assumed that the numbers in the files are unique regardless of final letter.

Believe it or not there is no letter in the text file nor the mp3 extension

But i will try to see if EVEN I can add the letters to the text file

I have an editor called search and replace so will look at this later

You are correct letters are unique

Thanks so much

Well i managed to add C.mp3 to every line "Notepad++" using a macro :smiley:

I found an mp3 that matched a line in the text file :smiley:

I only tried one mp3 and got this error on preview :angry:

No matching entry for file "E:\Mp3s\C\19814121C.mp3".

:wacko: :wacko: :wacko: :wacko: :wacko: :wacko:

I think it is very hard to tell from the distance why there is no match. We do not see the files, we do not see the import data, we do not see the mask.



|%_filename_ext% |%artist% |%title% |%dummy% |%dummy%/%dummy%/%year% |%dummy% |%dummy%

19824139C.mp3

Is This the reason


looking at the file extension

If you guys don't know i stand no chance

Thanks for trying




It is a little puzzling for me why the properties show the fiel extension twice: (.mp3) (.mp3)
If I open the properties of an mp3 file, I see it only once...

So could it be that the files are called e.g. 19824139C.mp3.mp3?
(Probably not)
But showing the extensions would reveal if the file name has e.g. a blank at the end in front of the extension.

Or you could copy the filename in all its beauty from the text file and paste it into the filter box and see which file is found.
The filename
19824139C.mp3 does not match
19824139C .mp3

Well opening the files in MP3TAG the file extension is just .mp3

In the filter box i tried

19814239C.mp3
19814239 C.mp3
19814239

They all found the correct and only file