2

I'm trying to access some mp3 tags like the release year from the mp3 file's album, which is stored in the id3v2 tags under TYER.

I found out that attributes like track_num are located in

class eyed3.core.Tag

Then the python command looks like this:

audiofile = eyed3.load(mp3_file) track_num = audiofile.tag.track_num[0]

Now the year is located in

class eyed3.core.Date(year,...)

So I thougt that would be:

year = audiofile.date.year

But I'm unfortunately wrong...

MSG: AttributeError: 'Mp3AudioFile' object has no attribute 'date'

Does anyone know how it works? Or, a more generic question: How can I get all of the available attributs?

My plattform is windows 10 pro.

Thanks

delaflota
  • 159
  • 1
  • 3
  • 12

1 Answers1

3

It's quite strange but I had to post this first before I could find the information myself:-)

It's in class eyed3.id3.tag.Tag

and is named: getBestDate()

The whole necessary code is then:

import eyed3
mp3_file = "The_File_Path"
audiofile = eyed3.load(mp3_file)
year = audiofile.tag.getBestDate()

For more information see the eyed3.pdf file

https://media.readthedocs.org/pdf/eyed3/latest/eyed3.pdf

Thanks

delaflota
  • 159
  • 1
  • 3
  • 12