我在一个带有 mp3 文件的文件夹中有以下 python 脚本:
import os
import eyed3
def track(file):
tag = eyed3.load(file)
tag.tag.comment = u"teststring"
tag.tag.genre = u"Pop"
tag.tag.save()
for fn in os.listdir('.'):
print fn[-3:]
if fn[-3:] == 'mp3':
track(fn)
“流派”设置或更改正确,但我的评论只是添加了一些垃圾。我在 winamp 中添加了一个“测试”到评论中,在我运行我的脚本并从命令行输出 ID3 信息后,我看到了这个:
ys3(01).mp3 [ 3.86 MB ]
-------------------------------------------------------------------------------
Time: 03:02 MPEG1, Layer III [ ~177 kb/s @ 48000 Hz - Joint stereo ]
-------------------------------------------------------------------------------
ID3 v2.3:
title: WANDERERS FROM YS - ?
artist:
album:
track: genre: Pop (id 13)
Comment: [Description: ] [Lang: eng]
Test
Comment: [Description: ÿþÿ] [Lang: eng]
þ
-------------------------------------------------------------------------------
我是否以错误的方式传递了“评论”?
最佳答案
我不假装理解为什么会这样,但请查看 the handy example file 中的评论是如何设置的:
from eyed3.id3 import Tag
t = Tag()
t.comments.set(u"Gritty, yo!")
我认为这与将评论放入框架有关,但其他人可能不得不对此进行更正。请注意,除非您将它传递给 unicode,否则这将失败。
这适用于以下版本:
↪ eyeD3 --version
eyeD3 0.7.4-beta (C) Copyright 2002-2013 Travis Shirk
关于python - 在 Python 中使用 EyeD3 设置 ID3 注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23591990/