當前位置: 首頁>>代碼示例>>Python>>正文


Python MusicBrainzClient.edit_release_tracklisting方法代碼示例

本文整理匯總了Python中editing.MusicBrainzClient.edit_release_tracklisting方法的典型用法代碼示例。如果您正苦於以下問題:Python MusicBrainzClient.edit_release_tracklisting方法的具體用法?Python MusicBrainzClient.edit_release_tracklisting怎麽用?Python MusicBrainzClient.edit_release_tracklisting使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在editing.MusicBrainzClient的用法示例。


在下文中一共展示了MusicBrainzClient.edit_release_tracklisting方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: are_similar

# 需要導入模塊: from editing import MusicBrainzClient [as 別名]
# 或者: from editing.MusicBrainzClient import edit_release_tracklisting [as 別名]
            discogs_track = discogs_tracks[position]
            if not are_similar(discogs_track['title'], mb_track['name']):
                colored_out(bcolors.FAIL, ' * track #%s not similar enough' % discogs_track['position'])
                changed = False
                break
            
            if discogs_track['position'] != mb_track['number'] \
                and re.match(r'^[A-Z]+[\.-]?\d*', discogs_track['position']) \
                and re.match(r'^\d+$', mb_track['number']):
                new_track['number'] = discogs_track['position']
                changed = True
            
            # Also set length if it's not defined on MB
            if discogs_track['duration'] != "" and mb_track['length'] is None:
                new_track['length'] = durationToMS(discogs_track['duration'])
                changed = True
            position += 1
                    
        if not changed:
            colored_out(bcolors.HEADER, ' * no changes found from %s' % release['discogs_url'])
        else:
            edit_note = 'Tracks number and/or length from attached Discogs link (%s)' % release['discogs_url']
            out(' * edit note: %s' % (edit_note,))
            time.sleep(5)
            mb.edit_release_tracklisting(release['gid'], new_mediums, edit_note, False)

    if release['processed'] is None:
        db.execute("INSERT INTO bot_discogs_track_number (gid) VALUES (%s)", (release['gid'],))
    else:
        db.execute("UPDATE bot_discogs_track_number SET processed = now() WHERE gid = %s", (release['gid'],))
開發者ID:legoktm,項目名稱:musicbrainz-bot,代碼行數:32,代碼來源:discogs_track_number.py


注:本文中的editing.MusicBrainzClient.edit_release_tracklisting方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。