本文整理汇总了Python中editing.MusicBrainzClient.edit_work方法的典型用法代码示例。如果您正苦于以下问题:Python MusicBrainzClient.edit_work方法的具体用法?Python MusicBrainzClient.edit_work怎么用?Python MusicBrainzClient.edit_work使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editing.MusicBrainzClient
的用法示例。
在下文中一共展示了MusicBrainzClient.edit_work方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: push_data
# 需要导入模块: from editing import MusicBrainzClient [as 别名]
# 或者: from editing.MusicBrainzClient import edit_work [as 别名]
def push_data():
mb = MusicBrainzClient(cfg.MB_USERNAME, cfg.MB_PASSWORD, cfg.MB_SITE)
for row in aClient.get_mb_data():
gid, workid, iswc, artist, work = row
note = 'Data taken from ' + aClient.search_url(str(workid), 'i')
mb.edit_work(gid, {'iswc': iswc}, note)
print artist + ' work: ' + work + ' Done!'
示例2: dict
# 需要导入模块: from editing import MusicBrainzClient [as 别名]
# 或者: from editing.MusicBrainzClient import edit_work [as 别名]
shs_work = shs.lookup_work(int(m.group(1)))
else:
continue
if 'language' in shs_work:
work = dict(work)
shs_lang = shs_work['language']
if shs_lang not in SHS_MB_LANG_MAPPING:
colored_out(bcolors.FAIL, ' * No mapping defined for language ''%s' % shs_lang)
else:
work['iswcs'] = []
for (iswc,) in db.execute(iswcs_query, work['id']):
work['iswcs'].append(iswc)
work['language'] = SHS_MB_LANG_MAPPING[shs_lang]
update = ('language',)
colored_out(bcolors.HEADER, ' * using %s, found language: %s' % (work['shs_url'], shs_lang))
edit_note = 'Setting work language from attached SecondHandSongs link (%s)' % work['shs_url']
out(' * edit note: %s' % (edit_note,))
mb.edit_work(work, update, edit_note)
else:
colored_out(bcolors.NONE, ' * using %s, no language has been found' % (work['shs_url'],))
if work['processed'] is None:
db.execute("INSERT INTO bot_shs_work_lang (work) VALUES (%s)", (work['gid'],))
else:
db.execute("UPDATE bot_shs_work_lang SET processed = now() WHERE work = %s", (work['gid'],))