Python - eyeD3 Lame 标签 CRC 检查失败

标签 python mp3 media crc eyed3

我正在尝试使用 Python 和 eyeD3 编写一个脚本来清理 mp3 文件名,但是当我尝试使用以下命令加载 mp3 文件时,我收到“警告:eyed3.mp3.headers:Lame 标签 CRC 检查失败”脚本

import string
import os
import eyed3

count = 0

for root, dirs, filenames in os.walk('path'):
    for song in filenames:
        audiofile = eyed3.load(song)

因此,我无法重命名库中的大部分文件。在这个主题上有任何经验或可以使用不同的库吗?

最佳答案

我找到了第一个检测方法来检测那些遗憾地发送到 stdout 的 eye3d“错误”: 事实上,eyed3 并不像看起来那么脏,因为它的错误和实际上的 log.warnings, 所以我通过以这种方式查看日志得到了这些错误: - 在 eye3d 调用之前,我将日志重定向到一个 stringIO - 在 eye3d 调用之后,我检查这个 stringIO 是否仍然为空(或不是)

示例代码:

import logging
import io
import eyed3

log_stream = io.StringIO()
logging.basicConfig(stream=log_stream, level=logging.INFO)
audiofile = eyed3.load('myfullfilename')
llog = log_stream.getvalue()
if llog:
    # deal here with the error message which in llog
    # and then purge the log_stream to reuse it for next eye3d call
    log_stream.truncate(0)
# all this code can be improved : enclose it in a try..catch, etc.

关于Python - eyeD3 Lame 标签 CRC 检查失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36636063/

相关文章:

python - 如何在pygtk中添加opencv窗口?

python - 代码优化——Python中的函数调用次数

java - 将 pcm 数据转换为低尺寸音频类型 - Java/Android

android - 按下后退按钮时停止媒体播放器 MP3

javascript - 在网页中播放mp3文件没有间隙?

python - 将字典列表转换为数据框

python - 如果在值中找到嵌套字典中另一个键的值,则替换字典中的值

linux - MPEG 破折号 :using Gpac to get MPD files

javascript - 在 Wordpress Media Uploader (3.5) 中显示图像大小

javascript - 是否有任何 JavaScript/jQuery 插件允许我在播放歌曲达到特定播放时间时触发 Action ?