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


Python MusicBrainzClient.set_release_packaging方法代码示例

本文整理汇总了Python中editing.MusicBrainzClient.set_release_packaging方法的典型用法代码示例。如果您正苦于以下问题:Python MusicBrainzClient.set_release_packaging方法的具体用法?Python MusicBrainzClient.set_release_packaging怎么用?Python MusicBrainzClient.set_release_packaging使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在editing.MusicBrainzClient的用法示例。


在下文中一共展示了MusicBrainzClient.set_release_packaging方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: colored_out

# 需要导入模块: from editing import MusicBrainzClient [as 别名]
# 或者: from editing.MusicBrainzClient import set_release_packaging [as 别名]
    'jewel case': 1,
    'slim jewel case': 2,
    'digipak': 3,
    'cardboard/paper sleeve': 4,
    'other': 5,
    'keep case': 6,
    'none': 7,
}

for release in db.execute(query):
    colored_out(bcolors.OKBLUE, 'Looking up release "%s" by "%s" http://musicbrainz.org/release/%s' % (release['name'], release['ac_name'], release['gid']))

    m = re.match(r'http://www.discogs.com/release/([0-9]+)', release['discogs_url'])
    if m:
        discogs_release = discogs.Release(int(m.group(1)))

    discogs_packaging = discogs_get_release_packaging(discogs_release)
    if discogs_packaging:
        colored_out(bcolors.OKGREEN, ' * using %s, found packaging: %s' % (release['discogs_url'], discogs_packaging))
        edit_note = 'Setting release packaging from attached Discogs link (%s)' % release['discogs_url']
        out(' * edit note: %s' % (edit_note,))
        mb.set_release_packaging(release['gid'], release['packaging'], DISCOGS_MB_PACKAGING_MAPPING[discogs_packaging], edit_note, True)
    else:
        colored_out(bcolors.NONE, ' * using %s, no matching packaging has been found' % (release['discogs_url'],))

    time.sleep(2)
    if release['processed'] is None:
        db.execute("INSERT INTO bot_discogs_release_packaging (release) VALUES (%s)", (release['gid'],))
    else:
        db.execute("UPDATE bot_discogs_release_packaging SET processed = now() WHERE release = %s", (release['gid'],))
开发者ID:tommycrock,项目名称:musicbrainz-bot,代码行数:32,代码来源:discogs_release_packaging.py


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