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