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


Python MusicBrainzClient.edit_relationship方法代码示例

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


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

示例1: EXISTS

# 需要导入模块: from editing import MusicBrainzClient [as 别名]
# 或者: from editing.MusicBrainzClient import edit_relationship [as 别名]
        AND NOT EXISTS (SELECT 1 FROM l_recording_work lrw2 WHERE lrw2.entity0 = r.id AND lrw2.entity1 <> lrw.entity1)
    ORDER BY r.artist_credit
    LIMIT 750
"""

date_re = re.compile(r'live, (\d{4})(?:-(\d{2}))?(?:-(\d{2}))?:', re.I)
for recording in db.execute(query):

    m = re.match(date_re, recording['comment'])
    if m is None:
        continue

    date = {'year': int(m.group(1))}

    if m.group(2) is not None:
        date['month'] = int(m.group(2))
    if m.group(3) is not None:
        date['day'] = int(m.group(3))
  
    colored_out(bcolors.OKBLUE, 'Setting performance relationships dates of http://musicbrainz.org/recording/%s "%s (%s)"' % (recording['r_gid'], recording['name'], recording['comment']))

    attributes = {}
    edit_note = 'Setting relationship dates from recording comment: "%s"' % recording['comment']
    colored_out(bcolors.NONE, " * new date:", date)
    
    entity0 = {'type': 'recording', 'gid': recording['r_gid']}
    entity1 = {'type': 'work', 'gid': recording['w_gid']}

    time.sleep(2)
    mb.edit_relationship(recording['rel_id'], entity0, entity1, recording['link_type'], attributes, date, date, edit_note, True)
开发者ID:legoktm,项目名称:musicbrainz-bot,代码行数:32,代码来源:live_recordings_dates.py

示例2: int

# 需要导入模块: from editing import MusicBrainzClient [as 别名]
# 或者: from editing.MusicBrainzClient import edit_relationship [as 别名]
    date = {"year": int(m.group(1))}

    if m.group(2) is not None:
        date["month"] = int(m.group(2))
    if m.group(3) is not None:
        date["day"] = int(m.group(3))

    colored_out(
        bcolors.OKBLUE,
        'Setting performance relationships dates of http://musicbrainz.org/recording/%s "%s (%s)"'
        % (recording["gid"], recording["name"], recording["comment"]),
    )

    attributes = {}
    edit_note = 'Setting relationship dates from recording comment: "%s"' % recording["comment"]
    colored_out(bcolors.NONE, " * new date:", date)

    time.sleep(15)
    mb.edit_relationship(
        recording["rel_id"],
        "recording",
        "work",
        recording["link_type"],
        recording["link_type"],
        attributes,
        date,
        date,
        edit_note,
        True,
    )
开发者ID:weisslj,项目名称:musicbrainz-bot,代码行数:32,代码来源:live_recordings_dates.py

示例3: EXISTS

# 需要导入模块: from editing import MusicBrainzClient [as 别名]
# 或者: from editing.MusicBrainzClient import edit_relationship [as 别名]
        AND lt.name = 'performance'
        AND r.edits_pending = 0 AND lrw.edits_pending = 0
        /* Only one linked work */
        AND NOT EXISTS (SELECT 1 FROM l_recording_work lrw2 WHERE lrw2.entity0 = r.id AND lrw2.entity1 <> lrw.entity1)
    ORDER BY r.artist_credit
    LIMIT 750
"""

date_re = re.compile(r'live, (\d{4})(?:-(\d{2}))?(?:-(\d{2}))?:', re.I)
for recording in db.execute(query):

    m = re.match(date_re, recording['comment'])
    if m is None:
        continue

    date = {'year': int(m.group(1))}

    if m.group(2) is not None:
        date['month'] = int(m.group(2))
    if m.group(3) is not None:
        date['day'] = int(m.group(3))
  
    colored_out(bcolors.OKBLUE, 'Setting performance relationships dates of http://musicbrainz.org/recording/%s "%s (%s)"' % (recording['gid'], recording['name'], recording['comment']))

    attributes = {}
    edit_note = 'Setting relationship dates from recording comment: "%s"' % recording['comment']
    colored_out(bcolors.NONE, " * new date:", date)
    
    time.sleep(15) 
    mb.edit_relationship(recording['rel_id'], 'recording', 'work', recording['link_type'], recording['link_type'], attributes, date, date, edit_note, True)
开发者ID:JesseWeinstein,项目名称:musicbrainz-bot,代码行数:32,代码来源:live_recordings_dates.py


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