当前位置: 首页>>代码示例>>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;未经允许,请勿转载。