本文整理汇总了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'],))