本文整理汇总了Python中musicbrainz2.webservice.Query.submitPuids方法的典型用法代码示例。如果您正苦于以下问题:Python Query.submitPuids方法的具体用法?Python Query.submitPuids怎么用?Python Query.submitPuids使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类musicbrainz2.webservice.Query
的用法示例。
在下文中一共展示了Query.submitPuids方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testSubmitPuid
# 需要导入模块: from musicbrainz2.webservice import Query [as 别名]
# 或者: from musicbrainz2.webservice.Query import submitPuids [as 别名]
def testSubmitPuid(self):
tracks2puids = {
'6a47088b-d9e0-4088-868a-394ee3c6cd33':'c2a2cee5-a8ca-4f89-a092-c3e1e65ab7e6',
'b547acbc-58c6-4a31-9806-e2348db3a167':'c2a2cee5-a8ca-4f89-a092-c3e1e65ab7e6'
}
ws = FakeWebService()
q = Query(ws, clientId='test-1')
q.submitPuids(tracks2puids)
self.assertEquals(len(ws.data), 1)
req = ws.data[0]
qstring = 'client=test-1&puid=6a47088b-d9e0-4088-868a-394ee3c6cd33+c2a2cee5-a8ca-4f89-a092-c3e1e65ab7e6&puid=b547acbc-58c6-4a31-9806-e2348db3a167+c2a2cee5-a8ca-4f89-a092-c3e1e65ab7e6'
self.assertEquals(req[0], 'track')
self.assertEquals(req[2], qstring)
示例2: print
# 需要导入模块: from musicbrainz2.webservice import Query [as 别名]
# 或者: from musicbrainz2.webservice.Query import submitPuids [as 别名]
tp.releaseTrack(tr)
if status == tunepimp.eError:
print ("%s:\n\tError: %s\n" % (fileName, tp.getError())).encode('ascii', 'ignore')
tp.remove(fileId)
if addPUID:
try:
fileName, puid, trackId = addPUID
print ("%s:\n\t%s - %s" % (fileName, puid, trackId)).encode('ascii', 'ignore')
flt = TrackFilter(puid=puid)
result = q.getTracks(flt)
found = False
for res in result:
if extractUuid(res.track.id, 'track') == trackId:
found = True
if not found:
toSubmit[trackId] = puid
print
else:
print "\tAlready in MB, skipping.\n"
except:
print "EXCEPTION THROWN LOOKING UP TRACK ID"
tp.remove(fileId)
if len(toSubmit) >= batchSize or (tp.getNumFiles() == 0 and len(toSubmit) > 0):
print "Submitting %d PUIDs to MusicBrainz...\n" % (len(toSubmit),)
q.submitPuids(toSubmit)
toSubmit = {}