當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。