本文整理汇总了Python中musicbrainz2.webservice.Query.submitCDStub方法的典型用法代码示例。如果您正苦于以下问题:Python Query.submitCDStub方法的具体用法?Python Query.submitCDStub怎么用?Python Query.submitCDStub使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类musicbrainz2.webservice.Query
的用法示例。
在下文中一共展示了Query.submitCDStub方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: testSubmitCdStub
# 需要导入模块: from musicbrainz2.webservice import Query [as 别名]
# 或者: from musicbrainz2.webservice.Query import submitCDStub [as 别名]
def testSubmitCdStub(self):
from musicbrainz2.model import Disc, CDStub
ws = FakeWebService()
q = Query(ws, clientId='test-1')
discid = "6EmGGSLhuDYz2lNXtqrCiCCqO0o-"
disc = Disc(discid)
disc.firstTrackNum = 1
disc.lastTrackNum = 4
disc.sectors = 89150
disc.addTrack( (150, 20551) )
disc.addTrack( (20701, 26074) )
disc.addTrack( (46775, 19438) )
disc.addTrack( (66213, 22937) )
cdstub = CDStub(disc)
cdstub.artist = "artist"
cdstub.title = "title"
cdstub.addTrack("trackname1")
cdstub.addTrack("trackname2")
cdstub.addTrack("trackname3")
cdstub.addTrack("trackname4")
q.submitCDStub(cdstub)
cdstub.barcode = "12345"
cdstub.comment = "acomment"
q.submitCDStub(cdstub)
self.assertEquals(len(ws.data), 2)
req = ws.data[0]
qstring = 'client=test-1&discid=6EmGGSLhuDYz2lNXtqrCiCCqO0o-&title=title&artist=artist&track0=trackname1&track1=trackname2&track2=trackname3&track3=trackname4&toc=1+4+89150+150+20701+46775+66213'
self.assertEquals(req[0], 'release')
self.assertEquals(req[2], qstring)
req = ws.data[1]
qstring = 'client=test-1&discid=6EmGGSLhuDYz2lNXtqrCiCCqO0o-&title=title&artist=artist&barcode=12345&comment=acomment&track0=trackname1&track1=trackname2&track2=trackname3&track3=trackname4&toc=1+4+89150+150+20701+46775+66213'
self.assertEquals(req[2], qstring)
cdstub._tracks = []
cdstub.addTrack("tname1", "artist1")
cdstub.addTrack("tname2", "artist2")
cdstub.addTrack("tname3", "artist3")
cdstub.addTrack("tname4", "artist4")
q.submitCDStub(cdstub)
self.assertEquals(len(ws.data), 3)
req = ws.data[2]
qstring = 'client=test-1&discid=6EmGGSLhuDYz2lNXtqrCiCCqO0o-&title=title&artist=artist&barcode=12345&comment=acomment&track0=tname1&artist0=artist1&track1=tname2&artist1=artist2&track2=tname3&artist2=artist3&track3=tname4&artist3=artist4&toc=1+4+89150+150+20701+46775+66213'
self.assertEquals(req[2], qstring)