使用Python访问MP3音乐数据 [英] Access MP3 music data using Python

查看:71
本文介绍了使用Python访问MP3音乐数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试编写Python脚本,以使用歌曲的数据作为比较基础来搜索重复的mp3/4文件.我的情况涉及许多具有相似文件名但ID3标签不同的mp3/4文件.最初,我尝试遍历并使用md5查找重复文件(忽略文件名).当然,当ID3标签不匹配时,这是行不通的.

I'm trying to write a Python script for searching out duplicate mp3/4 files using the song's data as the base for comparison. My situation involves many mp3/4 files with similar file names, but different ID3 tags. At first I tried looping through and using md5 to find duplicate files (ignoring file names). This, of course, didn't work when the ID3 tags didn't match.

因此,我正在寻找一种仅从mp3/4中提取音乐数据的方法,以便使其通过md5运行并查找任何重复项.最好的方法是什么?

As a result, I'm looking for a way to extract only the music data from an mp3/4 in order to run it through md5 and find any duplicates. What is the best way to go about this?

推荐答案

尝试使用 id3-py 诱变去除所有标签(ID3v1和ID3v2,它们都可以放在同一个文件上),然后根据结果计算MD5.

Try using id3-py or mutagen to strip out all the tags (both ID3v1 and ID3v2, they can both be on the same file), then computing the MD5 on the result.

假设iTunes没有在标签之外处理文件,则它们应该是相同的.转码显然会使该方法无效.

Assuming iTunes didn't manipulate the file beyond tags they should be identical. Transcoding obviously would make this approach invalid.

这篇关于使用Python访问MP3音乐数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆