當前位置: 首頁>>代碼示例>>Python>>正文


Python MbXmlParser.getArtist方法代碼示例

本文整理匯總了Python中musicbrainz2.wsxml.MbXmlParser.getArtist方法的典型用法代碼示例。如果您正苦於以下問題:Python MbXmlParser.getArtist方法的具體用法?Python MbXmlParser.getArtist怎麽用?Python MbXmlParser.getArtist使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在musicbrainz2.wsxml.MbXmlParser的用法示例。


在下文中一共展示了MbXmlParser.getArtist方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testTags

# 需要導入模塊: from musicbrainz2.wsxml import MbXmlParser [as 別名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getArtist [as 別名]
	def testTags(self):
		f = os.path.join(VALID_ARTIST_DIR, 'Tchaikovsky-2.xml')
		md = MbXmlParser().parse(f)
		artist = md.getArtist()
		
		self.failIf( artist is None )
		self.assertEquals(artist.getTag('classical').count, 100)
		self.assertEquals(artist.getTag('russian').count, 60)
		self.assertEquals(artist.getTag('romantic era').count, 40)
		self.assertEquals(artist.getTag('composer').count, 120)
開發者ID:bh0085,項目名稱:programming,代碼行數:12,代碼來源:test_wsxml_artist.py

示例2: testArtistBasic

# 需要導入模塊: from musicbrainz2.wsxml import MbXmlParser [as 別名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getArtist [as 別名]
	def testArtistBasic(self):
		f = os.path.join(VALID_ARTIST_DIR, 'Tori_Amos_1.xml')
		md = MbXmlParser().parse(f)
		artist = md.getArtist()

		self.failIf( artist is None )
		self.assertEquals(artist.getName(), 'Tori Amos')
		self.assertEquals(artist.getSortName(), 'Amos, Tori')
		self.assertEquals(artist.getBeginDate(), '1963-08-22')
		self.assertEquals(len(artist.getReleases()), 0)
開發者ID:bh0085,項目名稱:programming,代碼行數:12,代碼來源:test_wsxml_artist.py

示例3: testAliases

# 需要導入模塊: from musicbrainz2.wsxml import MbXmlParser [as 別名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getArtist [as 別名]
	def testAliases(self):
		f = os.path.join(VALID_ARTIST_DIR, 'Tori_Amos_4.xml')
		md = MbXmlParser().parse(f)
		artist = md.getArtist()
		
		self.failIf( artist is None )
		self.assertEquals(artist.getDisambiguation(), 'yes, that one')
		self.assertEquals(artist.getName(), 'Tori Amos')
		self.assertEquals(artist.getUniqueName(),
			'Tori Amos (yes, that one)')

		aliases = artist.getAliases()
		self.assertEquals(len(aliases), 3)
		self.assertEquals(aliases[0].getValue(), 'Myra Ellen Amos')
		self.assertEquals(aliases[0].getScript(), 'Latn')
		self.assertEquals(aliases[1].getValue(), 'Myra Amos')
		self.assertEquals(aliases[2].getValue(), 'Torie Amos')
		self.assertEquals(aliases[2].getType(), NS_MMD_1 + 'Misspelling')
開發者ID:bh0085,項目名稱:programming,代碼行數:20,代碼來源:test_wsxml_artist.py

示例4: testArtistFull

# 需要導入模塊: from musicbrainz2.wsxml import MbXmlParser [as 別名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getArtist [as 別名]
	def testArtistFull(self):
		f = os.path.join(VALID_ARTIST_DIR, 'Tori_Amos_2.xml')
		md = MbXmlParser().parse(f)
		artist = md.getArtist()

		self.failIf( artist is None )
		self.assertEquals(artist.getId(),
			makeId('c0b2500e-0cef-4130-869d-732b23ed9df5'))
		self.assertEquals(artist.getName(), 'Tori Amos')
		self.assertEquals(artist.getSortName(), 'Amos, Tori')
		self.assert_(artist.getDisambiguation() is None)
		self.assertEquals(artist.getUniqueName(), artist.getName())
		self.assertEquals(artist.getBeginDate(), '1963-08-22')
		self.assertEquals(len(artist.getReleases()), 3)
		self.assertEquals(len(artist.getReleaseGroups()), 3)

		release1 = artist.getReleases()[0]
		self.assertEquals(release1.getTitle(), 'Strange Little Girls')
		self.assertEquals(release1.getAsin(), 'B00005NKYQ')

		# Check last release in more detail.
		#
		release3 = artist.getReleases()[2]
		self.assertEquals(release3.getId(),
			makeId('290e10c5-7efc-4f60-ba2c-0dfc0208fbf5', 'release'))
		self.assertEquals(len(release3.getTypes()), 2)
		self.assert_(NS_MMD_1 + 'Album' in release3.getTypes())
		self.assert_(NS_MMD_1 + 'Official' in release3.getTypes())
		self.assertEquals(release3.getTitle(), 'Under the Pink')
		self.assertEquals(release3.getAsin(), 'B000002IXU')
		self.assertEquals(release3.getArtist().getId(),
			makeId('c0b2500e-0cef-4130-869d-732b23ed9df5'))
		self.failIf(release3.getReleaseGroup() is None)
		self.assertEquals(release3.getReleaseGroup().id[-36:],
			'ef2b891f-ca73-3e14-b38b-a68699dab8c4')

		events = release3.getReleaseEvents()
		self.assertEquals(len(events), 5)
		self.assertEquals(events[0].getCountry(), 'DE')
		self.assertEquals(events[0].getDate(), '1994-01-28')
		self.assertEquals(events[4].getCountry(), 'AU')
		self.assertEquals(events[4].getDate(), '1994-11')

		self.assertEquals(release3.getEarliestReleaseDate(), '1994-01-28')
開發者ID:apotapov,項目名稱:musicproject,代碼行數:46,代碼來源:test_wsxml_artist.py

示例5: testReleaseGroups

# 需要導入模塊: from musicbrainz2.wsxml import MbXmlParser [as 別名]
# 或者: from musicbrainz2.wsxml.MbXmlParser import getArtist [as 別名]
	def testReleaseGroups(self):
		f = os.path.join(VALID_ARTIST_DIR, 'Tori_Amos_2.xml')
		md = MbXmlParser().parse(f)
		artist = md.getArtist()

		self.failIf(artist is None)
		releaseGroups = artist.getReleaseGroups()
		self.failIf(releaseGroups is None)
		self.assertEquals(len(releaseGroups), 3)

		expectedEntries = {
			'ef2b891f-ca73-3e14-b38b-a68699dab8c4': 'Under the Pink',
			'1fd43909-8056-3805-b2f9-c663ce7e71e6': 'To Venus and Back',
			'a69a1574-dfe3-3e2a-b499-d26d5e916041': 'Strange Little Girls'}

		for releaseGroup in releaseGroups:
			self.assertEquals(releaseGroup.getType(), NS_MMD_1 + 'Album')
			releaseGroupId = releaseGroup.id[-36:]
			self.assert_(releaseGroupId in expectedEntries)
			self.assertEquals(releaseGroup.getTitle(), expectedEntries[releaseGroupId])
			del expectedEntries[releaseGroupId]
開發者ID:apotapov,項目名稱:musicproject,代碼行數:23,代碼來源:test_wsxml_artist.py


注:本文中的musicbrainz2.wsxml.MbXmlParser.getArtist方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。