82870034 发表于 2017-5-5 09:11:56

利用Python工具转换mp3的id3信息的编码

  在使用Mac后,经常碰到这样的问题:通过Verycd下载的mp3在iTunes播放的时候显示乱码。
  这种情况几本是因为id3信息编码是GBK而非UTF-8引起的,所以只要我们对其编码做一个转换就可以了。
  如果你安装了easy_install 那么你可以非常方便的安装找个叫做mutagen的工具

Lukes-MacBook:~ Luke$ sudo easy_install mutagen
Password:
Searching for mutagen
Reading http://pypi.python.org/simple/mutagen/
Reading http://www.sacredchao.net/quodlibet/wiki/Development/Mutagen
Reading http://code.google.com/p/mutagen/
Best match: mutagen 1.18
Downloading http://mutagen.googlecode.com/files/mutagen-1.18.tar.gz
Processing mutagen-1.18.tar.gz
Running mutagen-1.18/setup.py -q bdist_egg --dist-dir /tmp/easy_install-3uPSYT/mutagen-1.18/egg-dist-tmp-bioiaE
zip_safe flag not set; analyzing archive contents...
Adding mutagen 1.18 to easy-install.pth file
Installing moggsplit script to /usr/local/bin
Installing mutagen-inspect script to /usr/local/bin
Installing mutagen-pony script to /usr/local/bin
Installing mid3iconv script to /usr/local/bin
Installing mid3v2 script to /usr/local/bin
Installed /Library/Python/2.6/site-packages/mutagen-1.18-py2.6.egg
Processing dependencies for mutagen
Finished processing dependencies for mutagen

  安装好了之后你就可以使用了,进入装有mp3文件的目录,然后运行

find . -iname "*.mp3" -execdir mid3iconv -e GBK {} \;

  OK,一切就这么简单。
页: [1]
查看完整版本: 利用Python工具转换mp3的id3信息的编码