本文整理汇总了Python中editing.MusicBrainzClient.add_artist方法的典型用法代码示例。如果您正苦于以下问题:Python MusicBrainzClient.add_artist方法的具体用法?Python MusicBrainzClient.add_artist怎么用?Python MusicBrainzClient.add_artist使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editing.MusicBrainzClient
的用法示例。
在下文中一共展示了MusicBrainzClient.add_artist方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: html_escape
# 需要导入模块: from editing import MusicBrainzClient [as 别名]
# 或者: from editing.MusicBrainzClient import add_artist [as 别名]
def html_escape(text):
"""Produce entities within text."""
return "".join(html_escape_table.get(c, c) for c in text)
for album in db.albums.find({'status': {'imported': False}})[:1]:
artist_key = 'cdbaby:' + album['artist_cdbaby_id']
if 'type' not in album:
album['type'] = 'album'
album_url = 'http://www.cdbaby.com/cd/' + album['_id'].split(':')[1]
print "adding", album_url
if 'artist_mbid' not in album:
artist = db.artists.find_one(artist_key)
if not artist:
artist_url = 'http://www.cdbaby.com/Artist/' + album['artist_cdbaby_id']
mbid = mb.add_artist({'name': album['artist']}, artist_url)
artist = {'_id': artist_key, 'mbid': mbid}
db.artists.save(artist)
print 'added artist', mbid
album['artist_mbid'] = artist['mbid']
#pprint.pprint(album)
edit_note = album_url
mbid = mb.add_release(album, edit_note)
mb.add_url('release', mbid, 78, album_url)
album['mbid'] = mbid
album['status']['imported'] = True
db.albums.save(album)
print 'added release', mbid
#form = album_to_form(album)
#print '<form action="http://musicbrainz.org/release/add" method="post">'