nicfit / eyeD3

eyeD3 is a Python module and command line program for processing ID3 tags. Information about mp3 files (i.e bit rate, sample frequency, play time, etc.) is also provided. The formats supported are ID3v1 (1.0/1.1) and ID3v2 (2.3/2.4).
http://eyed3.nicfit.net/
GNU General Public License v3.0
543 stars 58 forks source link

Is it possible to set tags based on the filename ? #155

Open marcelpaulo opened 6 years ago

marcelpaulo commented 6 years ago

I had a good read of the documentation but couldn't find anything about this: given a file without tags but with basic information such as track number, title, album and artist encoded in the filename, is it possible to set its tags based on the filename, given a pattern that describe the filename's format ?

Let me explain why I'm looking for this: I split single flac/ape/wv files into wav files and then to mp3, based on their cue files, using shntool. The resulting splitted files have no tags, so I've been using cuetag to set their tags based on the cue file used for splitting them. I then rename the files based on their tags using eyeD3. Before incorporating the mp3 files into my collection, I ran them through mp3diags, and it always detects that the ID3 frames have excessive padding, and I always remove them. It can only be cuetag that's adding this padding to the frames, since it's the only tool in this chain that adds ID3 frames, so I'd like to replace it. As I already use eyeD3 in the chain to rename the files, it seemed logical to use it to set the tags too, either by reading the cue file or getting the info from the filename (I can configure shntool to name the files with tracknumber, title, album and artist). It would be great being able to use eyeD3 for that.

marcelpaulo commented 6 years ago

I've just discovered that I can work around the excessive padding problem with eyeD3's option --max-padding: as eyeD3 is the last tool in the chain, and it fidgets with the ID3 tag since I ask it to remove frames TLEN and TSSE, specifying --max-padding 1024 results in a lean tag.

I guess my original question stands, out of sheer curiosity now, just in case.

nicfit commented 6 years ago

Hi @marcelpaulo , eyeD3 does not support such a feature, but I've wanted to in the past. It'd be a great feature for sure. Unfortunatley eyeD3 is only getting serous bug fix attention lately, so I don't have the time to work on it right now. Of course, PRs are welcome.

marcelpaulo commented 6 years ago

Thanks for your honest answer, @nicfit. Another reason for me to learn Python!

deekerno commented 5 years ago

@nicfit, I'd like to start implementing this. I suppose the way to do this would be to have the user supply a pattern string detailing where various information would be in the file, parse the filename against the pattern, and set it for that particular file. Do you have any additional ideas on how this should be implemented? Thanks!

nicfit commented 5 years ago

@adcrn Take a look at the eyeD3 display plugin. Tags info strings using a format, you should able to share some of that logic.. and a format language as well. Thanks!

oldpink commented 4 years ago

Just do what I did by using a simple bash script to automate the task. Just use a simple for loop to make it automatically do this for all mp3 files in your directory:

!/bin/sh

for s in *.mp3 ; do eyeD3 -t "$(basename "$s" .mp3)" "$s" done

Yes, it's just that easy.

atomGit commented 3 years ago

i'm also interested in seeing this feature added, however i suspect it may only really shine where the file name is along the lines of <artist> - <title>, at least for batch processing