This is the solution I found:
import eyed3
audiofile = eyed3.load (fileName)
if audiofile.tag == None:
audiofile.tag = eyed3.id3.Tag ()
audiofile.file_info = eyed3.id3.FileInfo (fileName)
audiofile.tag.artist = artist
audiofile.tag.title = unicode (title)
audiofile.tag.genre = unicode (genre)
img_fp = open (file_path, "rb")
# The type of image, the content of the jpg file, mime type, description
audiofile.tag.images.set(eyed3.id3.frames.ImageFrame.FRONT_COVER,
img_fp.read(), "image/jpeg", u" ")
audiofile.tag.save (filename=fileName, version=eyed3.id3.ID3_V2_3)
No hay comentarios:
Publicar un comentario