我正在尝试使用eyed3作为Python库,以便为大量.MP3文件更改艺术家名称。我尝试使用项目网页(http://eyed3.nicfit.net/)的示例代码,setsaudiofile.tag.artist更改了“贡献艺术家”。根据文档(在http://eyed3.nicfit.net/api/eyed3.html),标签对象没有其他艺术家字段。
是否可以使用eyed3来实际更改专辑艺术家?如果是这样的话,你能提供清晰、简洁的Python代码吗?
发布于 2013-09-20 23:21:58
对于一个大型的MP3s集合,您可以做的是将一个艺术家的所有歌曲放在一个特定的文件夹中。所有“酷玩”歌曲都放在“酷玩”文件夹里。
如果您使用的是Linux,则可以执行以下操作:
import os
import eyed3
folder = raw_input('Please enter the folder of music')
files = os.listdir(folder) # This will give us a list of all of the MP3s in that folder
artist = folder.split('/')[-1]
for x in files:
mp3 = eyed3.load(folder + '/' + x) # Loads each and every MP3
mp3.tag.artist = unicode(artist, "UTF-8") # Sets the "artist" tag to the artist name
mp3.tag.save() # Saves tag如果您使用的是Windows,只需通过将所有斜杠"/“转换为反斜杠"\”来编辑代码
上面的代码对我来说工作得很好。很高兴我能帮上忙:)
发布于 2015-02-23 06:51:43
这是我前段时间写下的更改该字段的命令:
eyeD3 --set-text-frame=TPE2:"Various Artists" filename.mp3其中,“各种艺术家”是您在“专辑艺术家”字段中想要的值。
https://stackoverflow.com/questions/14785475
复制相似问题