what's the difference between eyed3 and eyeD3, and how can i edit mp3 tags with python

廉价感情. 提交于 2019-12-10 11:47:30

问题


I'm trying to update my mp3 tags through python. I've downloaded eyed3, but i can only import eyed3 and not eyeD3. I saw some options for code with eyeD3 that do what i need. for example something like:

tag = eyeD3.Tag()
tag.link(mp3_file_name)
tag.setVersion([2,3,0])
tag.setArtist(u'\u897f\u306f\u3058\u3081')
tag.update()

But i can't do that with eyed3. Does someone knows what's the difference between eyed3 and eyeD3 and how can i download eyeD3? Or does anyone knows a different way to edit tags for mp3 file?

Thanks a lot.


回答1:


In the latest version i.e eyeD3 0.8 the import module has been changed from

import eyeD3 to import eyed3 and the usage is :

import eyed3

audio = eyed3.load(PATH_TO_YOUR_MP3)
#To retrieve Data
print audio.tag.artist
print audio.tag.album
print audio.tag.title

#To set Data
audio.tag.artist = u"ARTIST"
audio.tag.album= u"ALBUM"
audio.tag.title= u"TITLE"
audio.tag.save()



回答2:


I'm not sure what the difference is, I believe its actually the same package, eyed3 works as you require, you just need to pass save rather than update:

audiofile = eyed3.load("song.mp3")
audiofile.tag.artist = u"Nobunny"
audiofile.tag.album = u"Love Visions"
audiofile.tag.album_artist = u"Various Artists"
audiofile.tag.title = u"I Am a Girlfriend"
audiofile.tag.track_num = 4

audiofile.tag.save()



回答3:


eyeD3 is the command-line tool (e.g. eyeD3 --help), and eyed3 is the Python you can import. They are both part of the eyeD3 PyPI package.

Note, older versions of this software did name the module eyeD3 but this changed in version 0.7.



来源:https://stackoverflow.com/questions/29544986/whats-the-difference-between-eyed3-and-eyed3-and-how-can-i-edit-mp3-tags-with

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!