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


Python MbXmlParser.getTrack方法代码示例

本文整理汇总了Python中musicbrainz2.wsxml.MbXmlParser.getTrack方法的典型用法代码示例。如果您正苦于以下问题:Python MbXmlParser.getTrack方法的具体用法?Python MbXmlParser.getTrack怎么用?Python MbXmlParser.getTrack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在musicbrainz2.wsxml.MbXmlParser的用法示例。


在下文中一共展示了MbXmlParser.getTrack方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: testTrackFull

# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getTrack [as 别名]
	def testTrackFull(self):
		f = os.path.join(VALID_TRACK_DIR, 'Silent_All_These_Years_4.xml')
		md = MbXmlParser().parse(f)
		track = md.getTrack()

		self.failIf( track is None )
		self.assertEquals(track.getTitle(), 'Silent All These Years')
		self.assertEquals(track.getDuration(), 253466)

		artist = track.getArtist()
		self.failIf( artist is None )
		self.assertEquals(artist.getId(),
			makeId('c0b2500e-0cef-4130-869d-732b23ed9df5', 'artist'))
		self.assertEquals(artist.getType(), NS_MMD_1 + 'Person')
		self.assertEquals(artist.getName(), 'Tori Amos')
		self.assertEquals(artist.getSortName(), 'Amos, Tori')

		puids = track.getPuids()
		self.assertEquals(len(puids), 7)
		self.assertEquals(puids[0], 'c2a2cee5-a8ca-4f89-a092-c3e1e65ab7e6')
		self.assertEquals(puids[6], '42ab76ea-5d42-4259-85d7-e7f2c69e4485')
		
		isrcs = track.isrcs
		self.assertEquals(len(isrcs), 1)
		self.assertEquals(isrcs[0], 'USPR37300012')

		releases = track.getReleases()
		self.assertEquals(len(releases), 1)
		self.assertEquals(releases[0].getTitle(), 'Little Earthquakes')
		self.assertEquals(releases[0].getTracksOffset(), 2)
开发者ID:apotapov,项目名称:musicproject,代码行数:32,代码来源:test_wsxml_track.py

示例2: testTrackBasic

# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getTrack [as 别名]
	def testTrackBasic(self):
		f = os.path.join(VALID_TRACK_DIR, 'Silent_All_These_Years_1.xml')
		md = MbXmlParser().parse(f)
		track = md.getTrack()

		self.failIf( track is None )
		self.assertEquals(track.getTitle(), 'Silent All These Years')
		self.assertEquals(track.getDuration(), 253466)
开发者ID:apotapov,项目名称:musicproject,代码行数:10,代码来源:test_wsxml_track.py

示例3: testTrackRelations

# 需要导入模块: from musicbrainz2.wsxml import MbXmlParser [as 别名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getTrack [as 别名]
	def testTrackRelations(self):
		f = os.path.join(VALID_TRACK_DIR, 'Silent_All_These_Years_2.xml')
		md = MbXmlParser().parse(f)
		track = md.getTrack()

		self.failIf( track is None )
		self.assertEquals(track.getTitle(), 'Silent All These Years')
		self.assertEquals(track.getDuration(), 253466)

		trackRels = track.getRelations(Relation.TO_TRACK)
		self.assertEquals(len(trackRels), 1)
		rel1 = trackRels[0]
		self.assertEquals(rel1.getType(), NS_REL_1 + 'Cover')
		self.assertEquals(rel1.getDirection(), Relation.DIR_BACKWARD)
		self.assertEquals(rel1.getTargetId(),
			makeId('31e1c0c4-967f-435e-b09a-35ee079ee234', 'track'))
		self.assert_( rel1.getBeginDate() is None )
		self.assert_( rel1.getEndDate() is None )

		self.failIf( rel1.getTarget() is None )
		self.assertEquals(rel1.getTarget().getId(),
			makeId('31e1c0c4-967f-435e-b09a-35ee079ee234'))
		self.assertEquals(rel1.getTarget().getArtist().getId(),
			makeId('5bcd4eaa-fae7-465f-9f03-d005b959ed02', 'artist'))
开发者ID:apotapov,项目名称:musicproject,代码行数:26,代码来源:test_wsxml_track.py


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