當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。