本文整理汇总了Python中editing.MusicBrainzClient.set_release_medium_format方法的典型用法代码示例。如果您正苦于以下问题:Python MusicBrainzClient.set_release_medium_format方法的具体用法?Python MusicBrainzClient.set_release_medium_format怎么用?Python MusicBrainzClient.set_release_medium_format使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类editing.MusicBrainzClient
的用法示例。
在下文中一共展示了MusicBrainzClient.set_release_medium_format方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: colored_out
# 需要导入模块: from editing import MusicBrainzClient [as 别名]
# 或者: from editing.MusicBrainzClient import set_release_medium_format [as 别名]
colored_out(
bcolors.OKBLUE,
'Looking up medium #%s of release "%s" by "%s" http://musicbrainz.org/release/%s'
% (medium["position"], medium["name"], medium["ac_name"], medium["gid"]),
)
m = re.match(r"http://www.discogs.com/release/([0-9]+)", medium["discogs_url"])
if m:
discogs_release = discogs.Release(int(m.group(1)))
discogs_format = discogs_get_medium_format(discogs_release, medium["position"])
if discogs_format:
colored_out(bcolors.HEADER, " * using %s, found format: %s" % (medium["discogs_url"], discogs_format))
edit_note = "Setting medium format from attached Discogs link (%s)" % medium["discogs_url"]
out(" * edit note: %s" % (edit_note,))
mb.set_release_medium_format(
medium["gid"],
medium["position"],
medium["format"],
DISCOGS_MB_FORMATS_MAPPING[discogs_format],
edit_note,
True,
)
else:
colored_out(bcolors.FAIL, " * using %s, no matching format has been found" % (medium["discogs_url"],))
if medium["processed"] is None:
db.execute("INSERT INTO bot_discogs_medium_format (medium) VALUES (%s)", (medium["medium_id"],))
else:
db.execute("UPDATE bot_discogs_medium_format SET processed = now() WHERE medium = %s", (medium["medium_id"],))
示例2: colored_out
# 需要导入模块: from editing import MusicBrainzClient [as 别名]
# 或者: from editing.MusicBrainzClient import set_release_medium_format [as 别名]
'Vinyl': 7,
'12"': 31,
'10"': 30,
'7"': 29,
'CD': 1,
'CDr': 33,
'Cassette': 8,
'DigitalMedia': 12
}
for medium in db.execute(query):
colored_out(bcolors.OKBLUE, 'Looking up medium #%s of release "%s" by "%s" http://musicbrainz.org/release/%s' % (medium['position'], medium['name'], medium['ac_name'], medium['gid']))
m = re.match(r'http://www.discogs.com/release/([0-9]+)', medium['discogs_url'])
if m:
discogs_release = discogs.release(int(m.group(1)))
discogs_format = discogs_get_medium_format(discogs_release, medium['position'])
if discogs_format:
colored_out(bcolors.HEADER, ' * using %s, found format: %s' % (medium['discogs_url'], discogs_format))
edit_note = 'Setting medium format from attached Discogs link (%s)' % medium['discogs_url']
out(' * edit note: %s' % (edit_note,))
mb.set_release_medium_format(medium['gid'], medium['position'], medium['format'], DISCOGS_MB_FORMATS_MAPPING[discogs_format], edit_note, True)
else:
colored_out(bcolors.FAIL, ' * using %s, no matching format has been found' % (medium['discogs_url'],))
if medium['processed'] is None:
db.execute("INSERT INTO bot_discogs_medium_format (medium) VALUES (%s)", (medium['medium_id'],))
else:
db.execute("UPDATE bot_discogs_medium_format SET processed = now() WHERE medium = %s", (medium['medium_id'],))
示例3: AS
# 需要导入模块: from editing import MusicBrainzClient [as 别名]
# 或者: from editing.MusicBrainzClient import set_release_medium_format [as 别名]
releases_wo_7inch AS (
SELECT r.id, u.url, m.format
FROM release r
JOIN medium m ON m.release = r.id
JOIN l_release_url l ON l.entity0 = r.id AND l.link IN (SELECT id FROM link WHERE link_type = 78)
JOIN url u ON u.id = l.entity1
WHERE u.url LIKE 'http://www.encyclopedisque.fr/images/%%'
AND (m.format IS NULL OR m.format = 7)
AND NOT EXISTS (SELECT 1 FROM l_release_url WHERE l_release_url.entity1 = u.id AND l_release_url.entity0 <> r.id)
)
SELECT r.id, r.gid, r.name, ta.url, ta.format, ac.name
FROM releases_wo_7inch ta
JOIN s_release r ON ta.id = r.id
JOIN s_artist_credit ac ON r.artist_credit=ac.id
LEFT JOIN bot_encyclopedisque_medium_format b ON r.gid = b.gid
WHERE b.gid IS NULL
ORDER BY r.artist_credit, r.id
LIMIT 100
"""
for id, gid, name, url, format, ac_name in db.execute(query):
colored_out(bcolors.OKBLUE, 'Looking up release "%s" by "%s" http://musicbrainz.org/release/%s' % (name, ac_name, gid))
edit_note = 'Setting format to 7" based on attached link to Encyclopedisque (%s)' % url
out(' * edit note: %s' % (edit_note,))
mb.set_release_medium_format(gid, format, 29, edit_note)
time.sleep(5)
db.execute("INSERT INTO bot_encyclopedisque_medium_format (gid) VALUES (%s)", (gid,))