Mutagenerate是一个Python模块,它试图基于已设置的和公共网络资源尽可能多地扩展id3标签。
项目描述
使用可用的网络资源(例如Amazon)自动扩展id3标签。基于mutagen。
动机
您可能有一些标签非常少的歌曲(例如只有标题和艺术家),并且希望有更多信息,以便您的音乐数据库尽可能完整。例如,具有标准化流派将允许您轻松构建播放列表。时间是宝贵的,手动填写这些信息似乎是一项苦差事。该软件包的目标是自动构建这些信息,并具有合理的错误率。
想法
在许多情况下,只有标题和艺术家通常不会引起歧义,并且足以通过查询可用网络资源来收集其他标签。Amazon有一个巨大的数据库,使用这两个信息查询它通常会在第一个位置提供良好的结果。
该软件包查询Amazon然后收集以下信息
流派
专辑
封面
Amazon网址
用法
使用二进制文件
只使用Amazon的第一个搜索结果
mid3generate.py --source amazon "My Song.mp3"
使用MusicBrainz API
mid3generate.py --source musicbrainz "My Song.mp3"
手动列出id3标记文件
mid3ls ~/Music filename | artist | album | title | track | genre | cover | year The Beatles - Sgt. Pepper's Lonely Hearts Club Band-DP82hSD_BXU.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | Sgt. Pepper’s Lonely Hearts Club Band | 1 | Pop | 30734c | 1987 The Beatles - With a Little Help from My Friends-aXYdXBbVhU4.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | With a Little Help From My Friends | 2 | Pop | 30734c | 1987 The Beatles - Lucy in the Sky with Diamonds-e38oGAJ09f8.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | Lucy in the Sky With Diamonds | 3 | Pop | 30734c | 1987 The Beatles - Getting Better-QxqueWiTrPA.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | Getting Better | 4 | Pop | 30734c | 1987 The Beatles - Fixing a Hole-SZXZRtsuN8s.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | Fixing a Hole | 5 | Pop | 30734c | 1987 The Beatles - She's Leaving Home-oxYpUlcuQSM.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | She’s Leaving Home | 6 | Pop | 30734c | 1987 The Beatles - Being for the Benefit of Mr. Kite!--ly7NYOLGck.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | Being for the Benefit of Mr. Kite! | 7 | Pop | 30734c | 1987 The Beatles - Within You Without You-xVuZ83XgA9A.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | Within You Without You | 8 | Pop | 30734c | 1987 The Beatles - When I'm Sixty-Four-P0IgrkFMinI.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | When I’m Sixty‐Four | 9 | Pop | 30734c | 1987 The Beatles - Lovely Rita-f00-n_blwC4.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | Lovely Rita | 10 | Pop | 30734c | 1987 The Beatles - Good Morning Good Morning-as9txvOctPc.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | Good Morning Good Morning | 11 | Pop | 30734c | 1987 The Beatles - Sgt. Pepper's Lonely Hearts Club Band(Reprise)-RPovvrhlBJM.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | Sgt. Pepper’s Lonely Hearts Club Band (reprise) | 12 | Pop | 30734c | 1987 The Beatles - A Day in the Life-shZh-gFCeVU.mp3 | The Beatles | Sgt. Pepper’s Lonely Hearts Club Band | A Day in the Life | 13 | Pop | 30734c | 1987
为文件设置封面
mid3cover --set-cover path/to/cover song1.mp3 song2.m4a
扩展封面
mid3cover --expand-cover song1.mp3 song2.mp3
使用库
from mutagen.id3 import ID3 from mutagenerate.amazon import AmazonSource from mutagenerate.musicbrainz import MusicBrainzSource mp3 = ID3("My Song.mp3") AmazonSource().generate_and_save(mp3, update=False, yes=True) user = 'my-user-here' password = 'my-password-here' MusicBrainzSource(user, password).generate_and_save(mp3, update=False, yes=True)