Most of my MP3 files are tagged with both ID3v1 and ID3v2. I want to write a script to read the files and identify ID3v1 versions, regardless of additional ID3 versions.
I'm struggling with the following code (eyed3). isV1
is only True
if ID3v1 is the only used version. But the code prints
V1 > False
V2 > True
for files with ID3v1 and ID3v2.
The code uses eyed3 but I'd also accept mutagen (but could not find an example how to code it).
import eyed3
a = eyed3.load("song.mp3")
print("V1", a.tag.isV1())
print("V2", a.tag.isV2())
eyed3.id.tag.parse()
you can see that if ID3v2 is found then no potential ID3v1 is loaded anymore.eyed3.core.load()
you can see that the function has not only 1 parameter for the filename, but also a 2nd for which tag version you want to find/load.eyed3.id3
- you are most likely interested in any version of ID3v1 and any version of ID3v2.Combining that knowledge you have to load the file twice and act upon it:
v1 = eyed3.load("song.mp3", ID3_V1)
print("V1", v1.tag.isV1())
v2 = eyed3.load("song.mp3", ID3_V2)
print("V2", v2.tag.isV2())