当前位置: 首页>>代码示例>>Python>>正文


Python MusicBrainzClient.edit_work方法代码示例

本文整理汇总了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!'
开发者ID:Jokipii,项目名称:musicbrainz-bot,代码行数:9,代码来源:ascap-iswc.py

示例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'],))
开发者ID:Sophist-UK,项目名称:Sophist_musicbrainz-bot,代码行数:32,代码来源:shs_work_lang.py


注:本文中的editing.MusicBrainzClient.edit_work方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。