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


Python Query.submitCDStub方法代码示例

本文整理汇总了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)
开发者ID:apotapov,项目名称:musicproject,代码行数:51,代码来源:test_ws_query.py


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